○ RUNS IN YOUR BROWSER

Color Converter

Paste a colour in any CSS format, or pick one, and get it as HEX, RGB, HSL, HWB, OKLCH and CMYK, ready to copy. The contrast check shows straight away whether text in that colour is readable on white or black.

COLOUR

FORMATS

HEX
#4f46e5
RGB
rgb(79 70 229)
HSL
hsl(243 75% 59%)
HWB
hwb(243 27% 10%)
OKLCH
oklch(51.1% 0.23 277)
CMYK
cmyk(66% 69% 0% 10%)

CMYK is a plain conversion without a print profile; ask your printer for exact values.

CONTRAST (WCAG 2)

Sample text Aa

On white: 6.29:1

  • ✓ AA
  • ✕ AAA
  • ✓ AA large
  • ✓ AAA large
Sample text Aa

On black: 3.34:1

  • ✕ AA
  • ✕ AAA
  • ✓ AA large
  • ✕ AAA large
● Valid Read as HEX Processed locally · 0 bytes sent

Reading the formats

HEX is the short form web designers know, such as #4f46e5. RGB gives the red, green and blue amounts from 0 to 255. HSL describes hue as an angle on the colour wheel plus saturation and lightness, which makes "a bit lighter" easy. HWB is hue plus how much white and black is mixed in. OKLCH is the modern, perceptual way to write colours in CSS. CMYK approximates print inks.

Contrast and accessibility

Text needs enough contrast with its background to be readable, for everyone and especially for people with low vision. The ratio runs from 1:1 (no contrast) to 21:1 (black on white). Transparency is left out of the check, so test semi-transparent colours on the background they will actually sit on.

Transparent colours

An alpha value makes a colour see-through. The swatch shows a checkerboard behind it, HEX gets two extra digits, and rgb(), hsl(), hwb() and oklch() get a / alpha part, such as rgb(79 70 229 / 0.5).

How to convert a colour

  1. 1

    Enter a colour

    Type or paste a colour such as

  2. 2

    Copy the format you need

    Every format updates as you type, written as CSS you can paste into a stylesheet. HEX with transparency gets 8 digits; the others add a / alpha value.

  3. 3

    Check the contrast

    The colour is shown as text on white and on black with its WCAG contrast ratio, and badges show whether it passes AA and AAA for normal and large text.

Frequently asked questions

Which colour formats can I enter?

HEX with 3, 4, 6 or 8 digits, rgb() and rgba(), hsl() and hsla(), hwb(), oklch(), cmyk() and all 148 CSS colour names. Both the modern space syntax, rgb(79 70 229 / 50%), and the older comma syntax, rgba(79, 70, 229, 0.5), work.

What contrast ratio do I need?

WCAG AA asks for at least 4.5:1 for normal text and 3:1 for large text (about 24 px, or 19 px bold). AAA asks for 7:1 and 4.5:1. The badges show which levels the colour passes on a white and on a black background.

What is OKLCH and why use it?

OKLCH describes a colour by lightness, chroma (how colourful) and hue, in a way that matches how people see. Two colours with the same OKLCH lightness look equally light, which makes it easier to build palettes and hover states than with HSL. All modern browsers support it in CSS.

Is the CMYK value exact for printing?

No. It's a simple conversion without a colour profile, fine as a starting point. Real print colours depend on the paper, ink and printer, so ask your print shop for their profile or ask them to match a colour.

Why does it say my colour is outside sRGB?

OKLCH can describe colours more vivid than a normal screen can show. The other formats then use the nearest colour that fits in sRGB, the colour space of HEX, RGB and HSL.

On this page
Pages
Home
All tools
Suggest a tool
About
Privacy