piapia123
en

Colour Converter & WCAG Contrast Checker

Convert

Everything runs locally in your browser — nothing is uploaded

FOREGROUND
Opacity100%
BACKGROUND
PREVIEW

Large sample text

Body sample: treat this paragraph as your real content and see how hard it is to read against this background.

VALUES
HEX
HEX (with alpha)
RGB
HSL
HSV
HWB
CMYK
Inverse (channels inverted)
Complementary (hue +180°)

CMYK is a printing notation; this conversion is the naive formula with no colour profile. How much ink a given screen colour actually takes depends on the ink, the paper and the profile — treat these numbers as an estimate, not a proof.

PERCEPTUAL SPACES
OKLCH
OKLab
LCH
Lab
XYZ (D65)
Colour temperature (CCT)

Distances in these spaces roughly match what the eye sees, which makes them the right tool for “how different are these two colours”, gradients and palette work. The group above (RGB/HSL) describes how much light a display emits — a different question. Everything here is valid CSS (lab / oklch / color()) you can paste into a stylesheet. Note lab lightness runs 0-100 while oklab runs 0-1.

TERMINAL COLOURS (ANSI)
ANSI 16 (nearest)
Terminal escape
ANSI 256 (nearest)

Terminal palettes are user-configurable, so the same escape sequence is a different colour in someone else’s terminal. These rows give the nearest cell under the **conventional** palette (the VGA / Windows console one) — not an objective mapping. If you need a fixed colour in a script, use true colour (24-bit hex), which is independent of the user’s palette.

COLOUR TEMPERATURE

Colour temperature describes **the colour of a black body**, so only near-neutral colours have one — a saturated green does not, and the row above says so plainly rather than inventing a number. Click any chip to load it as the foreground. Low-temperature white points fall outside the sRGB gamut and are normalised by their largest channel here, which makes them paler than the real black-body colour. And what a screen shows also depends on its calibration: this strip is what a **standard sRGB display** should render.

CONTRAST (WCAG)

–

  • AA body text (≥ 4.5:1)–
  • AAA body text (≥ 7:1)–
  • AA large text (≥ 3:1)–
  • AAA large text (≥ 4.5:1)–

Move a colour between HEX, RGB, HSL, HWB and CMYK — change any one value and the rest follow. The picker and the text fields stay in sync, pasted values work with or without a leading #, and rgb(), hsl() and hwb() forms are all understood — including the rows this tool prints, which paste straight back in. A second group covers the perceptually uniform spaces (OKLCH, OKLab, LCH, Lab, XYZ): distances there roughly match what the eye sees, which makes them the right tool for colour difference, gradients and palette work, whereas RGB and HSL describe how much light a display emits. Below that sits a WCAG contrast check: it computes the real ratio between the foreground and background and tells you whether body text and large text clear AA and AAA. The grey that “looks fine” in a mockup is very often short of 4.5:1.

Features

  • HEX, RGB, HSL, HSV, HWB and CMYK conversions shown together, each copyable on its own
  • OKLCH, OKLab, LCH, Lab and XYZ alongside them — all printed as valid CSS (lab / oklch / color())
  • Correlated colour temperature (CCT) with Duv, so you can see whether a neutral sits at 2700 K or 6500 K
  • ⚠️ A saturated colour has no colour temperature; that row says so and explains why, instead of producing a number
  • A reference strip of seven common temperatures — candle, warm white, neutral, daylight, overcast — each clickable to load as the foreground
  • Nearest ANSI 16 and ANSI 256 terminal colours, with a ready-to-use escape sequence
  • Also the inverse colour (channels inverted) and the complementary colour (hue +180°) — two different answers to “the opposite colour”
  • 3, 4, 6 and 8-digit hex plus rgba / hsla alpha
  • Picker, text fields and preview stay in sync; one click swaps foreground and background
  • WCAG contrast ratio with four verdicts: AA 4.5:1, AAA 7:1, large-text AA 3:1 and large-text AAA 4.5:1
  • Suggests the most readable text colour for the chosen background, with its ratio
  • Says plainly when contrast is computed on the opaque colour because the foreground has alpha

How to use

  1. Type a colour value or pick one with the swatch
  2. Set the foreground and background separately — the preview sits between them
  3. Read the converted values and the four contrast verdicts below
  4. Use the copy button on any row to take that single format

FAQ

What is the difference between the inverse and the complementary colour?
The inverse inverts each channel (`r → 255 - r`), which is what a display means by “negative” — the filter in a photo editor. The complementary colour rotates the hue 180° while keeping saturation and lightness, which is the opposition a colour scheme means. For a saturated mid-tone they land close together; for pale, dark or grey colours they diverge sharply. Note in particular that grey has no complementary colour (there is no hue to rotate, so it comes back unchanged) but does have an inverse — which is why both rows are shown. Also, the complementary colour preserves HSL lightness, not WCAG relative luminance: the complement of yellow is a blue-violet, and the two differ several-fold in luminance terms, so when pairing a dark background with light text trust the contrast column rather than the colour wheel.
What does “not applicable” mean in the colour temperature row?
Colour temperature describes the colour of a black body — white, grey, and the warm white of an incandescent lamp. It answers “is this neutral warm or cool?”. A saturated green has no colour temperature: forcing its chromaticity onto the black-body locus returns a plausible-looking number (pure yellow comes out at 3927 K) that means nothing. So those colours say “not applicable” rather than getting a figure. A colour only slightly off the locus still gets a temperature plus its Duv — the offset from the locus — and above 0.02 it also carries a note that the figure holds only formally.
What is the difference between HSL and HSV?
Both are hue plus two components, but the second component differs: HSL’s L is lightness, where L=100% is always white; HSV’s V is value, where V=100% is the pure hue. Picker panels usually work in HSV because it is easier to aim, while CSS authors tend to use HSL.
Is the CMYK conversion accurate?
No — and it cannot be, which is why the tool says so and uses the naive formula with no colour profile. CMYK describes how much ink is laid down, and what that ink looks like on paper depends on the ink, the paper, the press and the colour profile (SWOP, FOGRA…); the same `C 0 M 100 Y 100 K 0` prints as different reds under different profiles. Worse, a screen colour has no single CMYK equivalent: solid black may be printed as `C0 M0 Y0 K100` or as a rich black `C60 M40 Y40 K100`, and the naive formula only ever gives the former. Use these numbers to estimate ink coverage, not to match colour.
What contrast ratio do I need?
WCAG 2 AA requires at least 4.5:1 for body text and 3:1 for large text (roughly 24px, or 18.66px bold and up). AAA raises those to 7:1 and 4.5:1. The ratio comes from the relative luminance of the two colours and is independent of font and size.
Why does this differ slightly from other tools?
Rounding. This tool uses the formula as written in the WCAG specification and displays two decimals. When a ratio sits right at 4.5 or 7, that small difference can flip the verdict — take the more conservative reading in that case.
How is contrast handled for a semi-transparent colour?
It is computed on the opaque value, and the tool says so. What you actually see depends on whatever sits behind the colour, so a strict figure would require compositing against the background first — treat the number as a guide.
What are OKLCH, Lab and LCH for, and how do they differ from HSL?
The difference is what the numbers mean. HSL and RGB are device-dependent: they describe how much light an sRGB display should emit, so the same `hsl(200 50% 50%)` looks subtly different on another screen. Lab, LCH, OKLab and OKLCH are perceptually uniform: distances between values roughly match differences the eye actually sees. Two practical consequences — colour difference should be judged in the latter (convert both colours and compare the numbers, which tracks human judgement far better than comparing RGB bytes), and gradients should be built in the latter (a blue-to-yellow gradient in RGB passes through a muddy grey stretch, known as the dead zone; in OKLCH it does not). CSS now supports `oklch()` and `lab()`, so these values paste straight into a stylesheet. Which to pick: OKLCH is the current recommendation — it avoids CIE Lab’s hue folding in the blue region and its lightness tracks the eye more closely. Lab and LCH stick around because Photoshop, Figma and the print industry have used them for decades. ⚠️ One common trap: `lab()` lightness runs 0-100 while `oklab()` lightness runs 0-1. The same letter, a hundredfold difference in range, and mixing them up raises no error — it just gives you a completely different colour.
Why do the Lab values differ slightly from another site?
Usually the white point. Defining Lab requires naming a white point — what counts as pure white. sRGB’s is D65 (slightly blue); CSS `lab()` mandates D50 (warmer, inherited from print and colour management). This tool follows CSS and uses D50, so the numbers match what a browser renders. Some tools skip the adaptation and use D65 directly, which turns red from `54.29 80.8 69.89` into `53.24 80.09 67.2` — plausible-looking numbers that simply do not agree with the browser or your design software. OKLab and OKLCH have no such ambiguity: the white point is baked into the matrices.
How reliable are the ANSI terminal colour rows?
“Which cell is nearest” is well defined; “what colour you see” is not. Terminal palettes are user-configurable, so the same escape sequence renders differently in someone else’s terminal — nothing the application can control. These rows therefore answer “nearest cell under the conventional palette” (the VGA / Windows console one), which is what you want for picking colours for a terminal theme or choosing an approximately matching colour for CLI output. If you need a fixed colour in a script, use true colour (24-bit hex), which is independent of the user’s palette. Note the 256-colour cube steps by 0/95/135/175/215/255 rather than an even 0/51/102/… — that is what terminals do, and this tool follows it.

Related tools