One colour, every format.

Paste a colour in whatever form you have it: a hex code from a brand guide, an rgb() value from a web page, a name like teal, or a newer format such as oklch(). The converter shows the same colour in each common format, each with its own Copy button.

It also tells you whether white or black text reads better on that colour.

Runs in your browser. Nothing is uploaded.

How to use it

  1. Type or paste a colour into the Colour box, for example #1e90ff, rgb(30 144 255) or rebeccapurple.
  2. Or use the Picker to choose a colour by eye.
  3. Read the table: HEX, RGB, RGB (legacy), HSL, HWB, OKLCH and CMYK (approx.).
  4. Press Copy on the row you need.
  5. Check the note under the table to see whether white or black text suits the colour.

Good to know

What you can paste

Anything your browser accepts as a CSS colour: hex codes with 3, 4, 6 or 8 digits, the CSS colour names, rgb(), hsl(), hwb(), lab(), lch(), oklab(), oklch() and color(). A 3 or 6 digit hex code also works without the #. Your browser reads the value itself, so the rules are exactly those of CSS. Colours outside the sRGB range, such as a very vivid display-p3 green, are brought to the nearest sRGB colour first.

A worked example

Dodger blue, #1e90ff, is red 30, green 144, blue 255. The table shows:

RGBrgb(30 144 255)
HSLhsl(209.6 100% 55.9%)
HWBhwb(209.6 11.8% 0%)
OKLCHoklch(65.2% 0.1901 253.21)
CMYK (approx.)88% 44% 0% 0%

How each format is worked out

HSL comes from the largest and smallest of the three channels: lightness is their average, saturation is how far apart they are, and the hue says which channel leads. HWB uses the same hue, with whiteness equal to the smallest channel and blackness equal to 1 minus the largest.

OKLCH follows the conversion in the W3C CSS Color Module Level 4: the channels are linearised, turned into CIE XYZ (D65), then into OKLab with its published matrices and a cube root, and finally into lightness L, chroma C and hue H. Equal steps of OKLCH lightness look like equal steps to the eye, which HSL does not manage.

CMYK uses the simple textbook formula, with r, g and b from 0 to 1:

K = 1 − max(r, g, b)
C = (1 − r − K) ÷ (1 − K)
M = (1 − g − K) ÷ (1 − K)
Y = (1 − b − K) ÷ (1 − K)

Real printing depends on the press, the paper and the inks, which a colour profile such as FOGRA or GRACoL describes. This formula knows none of that, so treat the CMYK row as a starting point and ask your printer for the final values.

Transparency

If your colour has an alpha value, it carries through: HEX gains two digits and the other formats end in / 0.5 or similar. The white or black text note ignores transparency.

Questions.

Why is CMYK marked approximate?

Screens mix light while printers mix ink, and the result on paper depends on the press, paper and ink set. The converter uses a plain formula with no print profile, so check the final values with whoever prints for you.

What is OKLCH good for?

It describes a colour by how light it looks, how colourful it is and its hue. Because its lightness matches what people see, it is handy for even shade scales and for keeping the same brightness across different hues. Current browsers accept oklch() in CSS.

Which format should I use in CSS?

Any of them work in current browsers. HEX is compact and familiar, rgb() and hsl() are easy to read, and oklch() is the easiest to adjust by hand. Pick one and use it consistently.

Why did my colour come back slightly different?

Formats such as lab(), oklch() or display-p3 can describe colours an ordinary sRGB screen cannot show. The browser brings them to the nearest sRGB colour before the converter reads them, so very vivid colours may shift.

How do I read the white or black text note?

It measures your colour against white and against black with the WCAG contrast formula and says which wins. For #1e90ff it gives 3.24:1 with white and 6.49:1 with black, so black text reads better on it.

Can I take a colour from an image?

Not directly. On some browsers and systems the Picker includes an eyedropper you can use on screen. Otherwise copy the hex code from your image editor and paste it in.