EN

HSL to HEX Converter

Enter hue, saturation and lightness, for example hsl(256.6, 61.6%, 55.1%), to get the HEX code and RGB values.

#6D46D3
#6D46D3
RGBrgb(109, 70, 211)
HSLhsl(256.6, 61.6%, 55.1%)
HSVhsv(256.6, 66.8%, 82.7%)
OKLCHoklch(0.519 0.205 290.1)

Working

  1. C = (1 − |2 × 0.551 − 1|) × 0.616 = 0.553
  2. X = C × (1 − |(256.6 / 60) mod 2 − 1|) = 0.153, m = L − C/2 = 0.274
  3. RGB = (109, 70, 211)
  4. HEX = #6D46D3

How to use it

  1. Type an HSL value; decimals are allowed.
  2. Read the HEX and RGB results.
  3. Copy the HEX code.

The HSL to HEX formula

  1. C = (1 − |2L − 1|) × S (with S and L as 0-1).
  2. X = C × (1 − |(H / 60) mod 2 − 1|), m = L − C/2.
  3. Pick (R′, G′, B′) by the 60° sector of H: (C, X, 0), (X, C, 0), (0, C, X), (0, X, C), (X, 0, C) or (C, 0, X).
  4. R = round((R′ + m) × 255), same for G and B, then write each as two HEX digits.

Frequently asked questions

What happens at hue 360?

Hue is an angle, so 360° is the same as 0° (red). The converter accepts 0-360.

Is HEX the same color as RGB?

Yes. A 6-digit HEX code is the same three RGB numbers written in base 16: two digits each for red, green and blue. Converting between them never changes the color.

Related tools