Colour tools

Colour code converter

Write or paste a colour code and convert it to HEX, RGB, HSL, HSB and CMYK.

Accepted forms; press one to try it

This tool runs entirely inside your browser. No file or text is sent to any server.

How to use

  1. Write or paste the colour code into the “Colour code” box. Every form shown under “Accepted forms” works; press any example to see it.
  2. Or choose the colour with the colour picker beside the box. If your browser has the “Pick a colour from the screen” button, you can use it to take the colour of any spot on the screen.
  3. The colour shows in the strip at once, and its code is written in every form.
  4. Press “Copy” beside a form to take that code. To go back to the first colour, press “Reset”.

Notes on this tool

These forms are read: HEX with 3, 4, 6 or 8 digits, with # or without it; RGB, HSL, HSB (HSV) and CMYK written as functions, such as rgb(30, 144, 255); three numbers in a row for RGB; and CSS colour names, such as dodgerblue. Persian digits work too. Newer CSS forms, such as hwb, lab and oklch, are not recognised.

A CSS colour name is shown only when the colour is exactly one of the 148 known names, so most colours have no name. Some colours have more than one name, such as aqua and cyan.

HSL, HSB and CMYK are written in whole numbers. If you turn the code of one of them back into RGB somewhere else, it may differ from the first colour by a few steps; HEX and RGB are exact.

The colour is worked out only in your own browser and is never saved or sent anywhere.

Frequently asked questions

What does an eight-digit HEX code mean?
In an eight-digit HEX code the last two digits are the transparency: ff is fully solid and 00 fully see-through; 80, for example, is about half. When a colour has transparency, this tool writes every form with it (except CMYK, which has none), and a chequerboard shows behind the colour in the strip.
What does a three-digit code such as fa0 mean?
Each digit is written twice: #fa0 is the same as #ffaa00. A four-digit code works the same way, with the last digit as the transparency.
What is the difference between HSL and HSB?
Both write a colour with three numbers: the hue (0 to 360 degrees), the saturation, and one number for lightness. In HSL the last number is the lightness: 50% is the pure colour and 100% is white. In HSB the last number is the brightness: 100% is the pure colour at full strength, and to reach white the saturation has to be zero. CSS knows only HSL; HSB is mostly shown by design programs.
Why is the CMYK here different from my printer’s?
This tool works CMYK out from RGB with a simple calculation. The real colour on paper depends on the ink, the paper and the machine, and print programs work it out with a “colour profile”, which no web page knows. For print, take the CMYK numbers from your design program or from the printer.
How do I take a colour from a picture or from somewhere on the screen?
If you see the “Pick a colour from the screen” button, press it and click any spot on the screen, even inside a picture. If you do not see it, your browser does not support it; choose the colour with the colour picker beside the box instead, or copy its code from a design program.

Related tools

Colour contrast checker

Check the contrast between text and background colour, and see if it meets the WCAG standard.

Colour tools