Color code converter

Convert a colour between HEX, RGB, HSL and CMYK. Type or paste a code, pick a colour with the colour picker, or change one of the values: all the other formats update at once. Below you see whether white or black text is easy to read on this colour.

Paste a code in another format and the rest is filled in. A CSS colour name works too.

or choose a colour
RGB
HSL
CMYK
  • HEX
  • RGB
  • HSL
  • CMYK

Readability of text on this colour

White text
Black text

How it works

  1. Enter a colour

    Type or paste a code (#1e90ff, rgb(30, 144, 255), hsl(...)) or a colour name, or pick a colour with the colour picker.

  2. See every format

    HEX, RGB, HSL and CMYK appear side by side at once. Change one value and the rest follows.

  3. Copy what you need

    Copy the code for your CSS, design or print with one click. Below you see whether white or black text is easy to read on it.

The formats

  • HEX (#1e90ff) is the usual way to write a colour on the web. The three pairs of digits are the amount of red, green and blue, from 00 to ff. A short form such as #f80 is the same as #ff8800.
  • RGB (rgb(30, 144, 255)) gives red, green and blue as a number from 0 to 255.
  • HSL (hsl(210, 100%, 56%)) gives hue (0 to 360 degrees on the colour wheel), saturation and lightness. Handy when you want to make a colour lighter or darker without changing its hue.
  • CMYK (cmyk(88%, 44%, 0%, 0%)) is the notation of printing: cyan, magenta, yellow and black.

What input works?

In the top field you can paste a code in any format: #1e90ff, 1e90ff, #f80, rgb(30 144 255), hsl(210, 100%, 56%) or a name such as dodgerblue. A transparency value (alpha) is ignored.

Readability of text

Under the result you see the contrast of the colour with white and with black, following the accessibility guidelines (WCAG). A ratio of 4.5 : 1 or more is easy to read for normal text (level AA), 7 : 1 or more is excellent (AAA), and from 3 : 1 large text is still fine. Use it to choose between white or black text.

Good to know

The conversion to CMYK is a plain mathematical formula. Printers work with colour profiles, so the printed colour can differ from what you see on your screen.

Frequently asked questions

What is the difference between HEX, RGB and HSL?

HEX and RGB describe the same colour as a mix of red, green and blue (HEX in hexadecimal digits). HSL describes it as hue, saturation and lightness, which makes it easier to make a colour lighter or darker.

Is the CMYK value exactly what the printer gets?

No. This is the usual mathematical conversion from RGB to CMYK. Printers use colour profiles, so the printed result can differ. Always ask for a proof when printing.

Which colour names work?

All CSS colour names, such as dodgerblue, tomato or rebeccapurple. The names come from your browser.

Is my colour stored?

No. Everything happens in your browser.