How to convert HEX to RGB
A HEX code is three pairs of hexadecimal digits: red, green and blue, each from 00 to FF (0–255). #D9412B breaks down into D9 = 217, 41 = 65 and 2B = 43, i.e. rgb(217, 65, 43). In HSL the same colour is hsl(8, 70%, 51%) — hue 8°, saturation 70%, lightness 51%.
The converter works both ways and has a colour picker — choose a colour with the mouse or type a code.
HEX, RGB and HSL — when to use which
- HEX — the shortest notation, standard in CSS, design files and brand guidelines.
- RGB — handy when you need transparency: rgb(217 65 43 / 50%).
- HSL — the easiest for shades: changing only lightness gives lighter and darker versions of the same colour.
- Short HEX: #F80 is the same as #FF8800 — each digit is doubled.
Colours for print
HEX, RGB and HSL describe screen colours. Printers work in CMYK (or Pantone), and converting from RGB always shifts the colour a little — very vivid screen colours may be impossible to print. For printed materials, ask for a colour proof.
Frequently asked questions
What are the HEX codes for white and black?
White is #FFFFFF (rgb 255, 255, 255), black #000000 (rgb 0, 0, 0).
Does letter case matter in a HEX code?
No — #d9412b and #D9412B are the same colour.