hex to HSL

HSL is a straightforward reshaping of encoded RGB, which is why its lightness does not match perceived brightness. OKLCh is the better choice when you need that.

Hue
Alpha
100%
HSL
hsl(216.9 89.9% 61%)

Paste a hex value — other formats work too.

Need every format at once? Open in the full picker

Worked examples

Common colours converted from hex to HSL, computed with the same engine the picker uses.

ColourhexHSLCopy
Pure red#ff0000hsl(0 100% 50%)
Pure green#00ff00hsl(120 100% 50%)
Pure blue#0000ffhsl(240 100% 50%)
White#ffffffhsl(300 100% 100%)
Mid grey#808080hsl(300 0% 50.2%)
Black#000000hsl(0 0% 0%)
Interface blue#4287f5hsl(216.9 89.9% 61%)
Success green#22c55ehsl(142.1 70.6% 45.3%)
Danger red#ef4444hsl(0 84.2% 60.2%)
Warning amber#f59e0bhsl(37.7 92.1% 50.2%)
Editor black#1e1e1ehsl(0 0% 11.8%)
Warm sand#e9c46ahsl(42.5 74.3% 66.5%)

How the conversion works

HSL is a straightforward reshaping of encoded RGB, which is why its lightness does not match perceived brightness. OKLCh is the better choice when you need that.

Both formats are computed from a single canonical representation — CIE XYZ with a D65 white point, held in floating point — rather than by chaining one format into the next. That matters because chained conversions accumulate rounding error, and because it means a colour that cannot be represented in the target format is handled deliberately rather than by accident.

When the source describes a colour outside the target's gamut, chroma is reduced in OKLCh while lightness and hue are held, following the CSS Color 4 gamut mapping algorithm. Clipping each channel independently would be simpler but visibly shifts hue on saturated colours.

Related conversions