Color Converter

Paste any CSS colour and get it in every format — HEX, RGB, HSL, HWB, OKLab and OKLCH — with a live preview and a WCAG contrast check against any background.

Runs in your browser — nothing you enter is sent to our servers

e.g. #3446d4, rgb(52 70 212), hsl(234 64% 52%), oklch(50% 0.2 270), tomato

Contrast

How it works

The colour is parsed into sRGB red, green, blue and alpha, then written out in each format:

  • HSL and HWB are rearrangements of sRGB (hue plus saturation and lightness, or whiteness and blackness).
  • OKLab and OKLCH use Björn Ottosson’s perceptual colour space: sRGB is linearised, mixed into cone responses and cube-rooted. OKLCH is the polar form (lightness, chroma, hue).
  • CMYK uses the basic formula K = 1 − max(R,G,B). It’s useful for rough work, not for print matching.
  • Contrast uses the WCAG 2.x relative-luminance formula and shows which AA and AAA levels pass.

Colours from OKLab/OKLCH that sRGB can’t display are clamped and flagged. Click any format to copy it.

Example

#ff0000 is rgb(255 0 0), hsl(0 100% 50%), hwb(0 0% 0%) and oklch(62.8% 0.2577 29.23).

Grey #777777 on white has a contrast ratio of 4.48:1, just short of AA for normal text. #767676 (4.54:1) passes. Small differences matter at the threshold.

Frequently asked questions

Which formats can I paste?

Hex (#rgb, #rgba, #rrggbb, #rrggbbaa), rgb()/rgba(), hsl()/hsla(), hwb(), oklab(), oklch() — in both the modern space-separated syntax (rgb(52 70 212 / 50%)) and the older comma syntax — plus all 148 CSS named colours such as rebeccapurple and transparent.

What is OKLCH and why use it?

OKLCH describes a colour by perceived lightness, chroma (colourfulness) and hue. Unlike HSL, equal lightness values look equally light across hues, which makes it easier to build consistent palettes and accessible colour scales. It’s supported in all major current browsers.

Why does it say “outside sRGB”?

OKLCH and OKLab can describe colours that ordinary sRGB screens can’t show. This tool converts in sRGB, so those colours are clamped to the nearest displayable value and flagged. Wide-gamut (Display P3) output isn’t calculated.

Is the CMYK value accurate for print?

No — it’s the simple mathematical conversion from RGB. Real print colours depend on the printer, ink and paper (ICC profiles). Ask your printer for a proof or use their profile.

How is contrast calculated?

With the WCAG 2.x formula (relative luminance). 4.5:1 passes AA for normal text and 3:1 for large text (about 24px, or 19px bold); 7:1 passes AAA. Semi-transparent colours are blended with the background first.

Related tools

Convert images between PNG, JPEG and WebP in bulk, with control over transparency.

FreeRuns in your browser

Escape & < > and quotes for HTML, and optionally write non-ASCII characters as named or numeric entities.

FreeRuns in your browser

Short, punchy thumbnail text options with a live 1280×720 preview you can download.

FreeRuns in your browser

Generate random v4 or time-ordered v7 UUIDs in bulk, in the format you need.

FreeRuns in your browser

Related guides