Using the converter
Paste a hex code such as #3366CC and the HSL value appears, ready to copy into CSS as hsl(220, 60%, 50%).
Swap the boxes to go back. The rows below give RGB and CMYK as well, and the contrast with black and white text.
How hex becomes HSL
Turn the hex pairs into red, green and blue, then divide each by 255. Lightness is the average of the largest and smallest of the three. Saturation is how far apart they are, scaled by how close the lightness is to the middle, so very dark and very light colours can still be fully saturated.
Hue is an angle round the colour wheel, with red at 0°, green at 120° and blue at 240°. Which channel is largest decides the part of the wheel, and the other two decide how far round. #3366CC is mostly blue with some green, so it sits at 220°.
Why designers use HSL
HSL is easier to change by hand than hex. Keep the hue and saturation and lower the lightness for a darker shade of the same colour, or keep the lightness and turn the hue for a matching colour with the same weight.
Lightness in HSL isn't how bright a colour looks, though. Yellow and blue at 50% lightness look very different, which is why the contrast rows use a separate measure.
Questions
Why is the hue 0 for grey?
A grey has no hue, because red, green and blue are equal. CSS writes it as 0 by convention.
Does converting to HSL and back change the colour?
It can by one or two in a channel, because HSL is rounded to whole numbers.
Sources
Added and reviewed . What's new






