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
#6D46D3RGB
rgb(109, 70, 211)HSL
hsl(256.6, 61.6%, 55.1%)HSV
hsv(256.6, 66.8%, 82.7%)OKLCH
oklch(0.519 0.205 290.1)Working
- C = (1 − |2 × 0.551 − 1|) × 0.616 = 0.553
- X = C × (1 − |(256.6 / 60) mod 2 − 1|) = 0.153, m = L − C/2 = 0.274
- RGB = (109, 70, 211)
- HEX = #6D46D3
How to use it
- Type an HSL value; decimals are allowed.
- Read the HEX and RGB results.
- Copy the HEX code.
The HSL to HEX formula
- C = (1 − |2L − 1|) × S (with S and L as 0-1).
- X = C × (1 − |(H / 60) mod 2 − 1|), m = L − C/2.
- 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).
- 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.