HEX to HSL Converter
Enter a HEX code to get its hue, saturation and lightness. HSL makes it easy to build lighter, darker or more muted versions of a color.
#6D46D3
hsl(256.6, 61.6%, 55.1%)HEX
#6D46D3RGB
rgb(109, 70, 211)HSV
hsv(256.6, 66.8%, 82.7%)OKLCH
oklch(0.519 0.205 290.1)Working
- R′ = 109/255 = 0.427, G′ = 70/255 = 0.275, B′ = 211/255 = 0.827
- Max = 0.827, Min = 0.275, Δ = 0.553
- L = (Max + Min) / 2 = 0.551 → 55.1%
- S = Δ / (1 − |2L − 1|) = 0.616 → 61.6%
- H = 256.6° → hsl(256.6, 61.6%, 55.1%)
How to use it
- Type or paste a HEX code.
- Read hue (0-360°), saturation and lightness (0-100%).
- Copy the hsl() value.
The HEX to HSL formula
- Convert HEX to RGB and divide each channel by 255 (R′, G′, B′).
- Max = the largest, Min = the smallest; Δ = Max − Min.
- Lightness L = (Max + Min) / 2.
- Saturation S = 0 if Δ = 0, otherwise Δ / (1 − |2L − 1|).
- Hue: if Max is R′, H = 60 × ((G′ − B′)/Δ mod 6); if G′, H = 60 × ((B′ − R′)/Δ + 2); if B′, H = 60 × ((R′ − G′)/Δ + 4).
Example: #6D46D3 → hsl(256.6, 61.6%, 55.1%).
Frequently asked questions
Why keep one decimal in HSL?
With whole numbers some colors cannot round-trip: converting back gives a neighbouring HEX code. One decimal is enough for every sRGB color to convert back exactly.
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.