TheFileTools

How to convert a colour between HEX, RGB, HSL and CMYK

Enter a colour as HEX, RGB or HSL and get every notation at once, including transparency, with honest limits for CMYK.

Design tools, stylesheets and print shops each describe the same colour differently. A brand guide gives a HEX code, your CSS variables use HSL, and the printer asks for CMYK.

Steps

  1. Open Colour converter.
  2. Type a colour into the field. It starts with #0071e3 as an example.
  3. Check the swatch, then press Copy next to the notation you need: HEX, RGB, HSL, CMYK or CSS.

What you can type

  • HEX with 3, 4, 6 or 8 digits, with or without the # sign. The short form f80 means ff8800. In the 4 and 8 digit forms, the last part is transparency.
  • RGB, for example rgb(0, 113, 227) or rgba(255, 0, 0, 0.5). Commas or spaces both work.
  • HSL, for example hsl(210, 100%, 45%) or hsla with a fourth value.

Colour names such as red or navy are not recognised, and CMYK cannot be typed in. It is an output only.

Worked example

#0071e3 gives rgb(0, 113, 227), hsl(210, 100%, 45%) and cmyk(100%, 50%, 0%, 11%). The CSS row shows the newer space-separated spelling, rgb(0 113 227), which current browsers accept.

With transparency, rgba(255, 0, 0, 0.5) gives the eight-digit HEX #ff000080 and the CSS form rgb(255 0 0 / 0.5).

Limits worth knowing

  • CMYK is an approximation. It is calculated with the standard arithmetic formula, without a colour profile. Real print colours depend on the press, the ink and the paper, so treat the values as a starting point and ask the print shop for their profile when colour accuracy matters.
  • Values are rounded to whole degrees and percent. Converting to HSL and back can shift a channel by one step.
  • Transparency has no CMYK equivalent and is left out of that row.

Related tools

If the colour you want is in a logo or screenshot, read it with Colour picker from image. A HEX code is three hexadecimal numbers written together, and Number base converter shows a single pair in decimal: E3 is 227.