Colour converter

Type or pick a colour to get it in HEX, RGB, HSL, HSB and CMYK, and see if white or black text on it passes the WCAG contrast rules.

FreeNo sign-upRuns on your device

Loading the tool…

How to use it

  1. Type a colour in any format, like #1C43F5 or rgb(28, 67, 245), or use the colour picker.
  2. Copy the format you need from the table.
  3. Check the contrast results to see if white or black text is readable on it.

The formats

HEX and RGB describe the same thing: how much red, green and blue light to mix, from 0 to 255 each. HEX writes those three numbers in base 16, so #1C43F5 is red 28, green 67 and blue 245.

HSL and HSB (also called HSV) describe a colour by hue, a position on the colour wheel from 0 to 360, then saturation and either lightness or brightness. They are easier for people to adjust: to make a colour lighter, raise the L in HSL. Design tools like Figma show HSB, and CSS supports HSL.

You can type any of these formats into the box, with or without the rgb() or hsl() wrapper, and short HEX codes like #FFF work too. The picker shows the same colour, so you can nudge it by eye and copy the new values.

Why CMYK is approximate

CMYK is the cyan, magenta, yellow and black ink used in print. The conversion here is the standard formula, but real printed colour depends on the paper, the inks and the printer's colour profile. Bright screen colours, especially vivid blues and greens, often can't be printed exactly. Use these CMYK numbers as a starting point and ask your printer for a proof.

Contrast and WCAG

The contrast ratio compares how light two colours are, from 1:1 (the same) to 21:1 (black on white). The Web Content Accessibility Guidelines (WCAG 2.2) ask for at least 4.5:1 for normal text and 3:1 for large text at level AA. Large means about 24 px, or 18.7 px in bold. Level AAA asks for 7:1 and 4.5:1. The tool tests your colour with both white and black text and tells you which reads better.

Privacy

All the maths runs in your browser. Nothing is sent or saved.

Questions

How do I convert HEX to RGB?

Split the six digits into three pairs and read each pair as a base 16 number. #1C43F5 becomes 1C, 43 and F5, which are 28, 67 and 245. Paste any HEX code here to do it instantly.

What contrast ratio do I need for accessibility?

At least 4.5:1 for normal body text and 3:1 for large text and icons, to meet WCAG 2.2 level AA. Most accessibility laws and audits use level AA.

Is HSB the same as HSL?

No. Both use hue and saturation, but HSB uses brightness and HSL uses lightness. A pure colour is 100% brightness in HSB but 50% lightness in HSL.

Can I trust the CMYK values for print?

Only as a starting point. Print colour depends on the paper and the printer's profile, so ask for a printed proof for brand colours.