HEX / RGB / HSL color converter

Convert colors between HEX, RGB and HSL with a live preview.

HEX
#D9412B
HSL
hsl(8, 70%, 51%)

Last updated: October 2026 · Report a calculation error

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.

See alsoWhole category

  1. IT-01Base64 encoder and decoderEncode text to Base64 or decode a Base64 string back to text.
  2. IT-02JSON formatter and validatorBeautify or minify JSON, check that it is valid and see exactly where a syntax error is.
  3. IT-04SHA-256 hash generatorGenerate SHA-256, SHA-1 and SHA-512 hashes of any text.
  4. IT-05Unix timestamp converterConvert Unix timestamps to dates and dates to timestamps, in seconds or milliseconds.