What is HSL?
HSL is a way to describe a colour with three numbers. H stands for hue, the colour itself, measured as a position on a colour wheel from 0 to 360 degrees. Red sits at 0, yellow at 60, green at 120, cyan at 180, blue at 240 and magenta at 300. S stands for saturation, how strong the colour is, from 0 to 100 percent. At 0 percent the colour is grey. At 100 percent it is vivid. L stands for lightness, how bright the colour is, from 0 to 100 percent. At 0 percent the colour is black. At 100 percent it is white. At 50 percent it is the full colour.
Designers like HSL because it matches how people think about colour. You pick a hue, then make it stronger or weaker, then make it darker or lighter. Hex codes do the same job, but they are harder to read: the hex code for a colour tells you nothing at a glance. That is why designers often pick a colour in HSL in their design tool, and then need the hex code to use it in code.
How to use it
Type the hue from 0 to 360. Then type the saturation and the lightness, both from 0 to 100. The tool shows the hex code at once, with a swatch of the colour and its RGB values. The result updates live as you type, so you can drag the numbers up and down and watch the colour change. Copy the hex code into your CSS, for example as color or background-color, or paste it into your design tool.
If you know the colour you want but not the numbers, start with a hue: 0 for red, 120 for green, 240 for blue. Set saturation to 100 and lightness to 50 for the strongest version. Then lower the saturation to soften it, or move the lightness up and down to make it lighter or darker.
Worked example
Take HSL 0, 100, 50. The hue is 0, which is red. Saturation is full and lightness is in the middle, so the result is pure red: hex #ff0000. That is the brightest red you can get. Change the hue to 120 and you get pure green, #00ff00. Change it to 240 and you get pure blue, #0000ff.
Now take a softer colour: HSL 210, 50, 60. The hue 210 sits between cyan and blue. Saturation is half, so the colour is muted. Lightness is 60, a little above the middle. The result is #6699cc, a calm blue-grey that works well for buttons and links. A third example shows the edges: HSL 0, 0, 0 is black, #000000, and HSL 0, 0, 100 is white, #ffffff, because with no saturation the hue does not matter at all.
Use cases
Web designers use this tool every day, because CSS accepts hex codes directly and design tools often show HSL. A designer picks a brand colour in HSL, converts it here, and pastes the hex into the stylesheet. Developers use it when a design file gives HSL values and the code needs hex. Bloggers use it to pick matching colours for headings and buttons, by moving the hue around the wheel and keeping the saturation and lightness steady.
Honest limitations
This tool converts the numbers exactly, but screens are not exact. The same hex code looks a little different on a phone, a laptop and a projector, because screens show colour differently. The tool also works in the sRGB colour space, which is the standard for the web, but some design tools use wider colour spaces, so a very vivid colour may shift slightly. HSL itself is a simple model: two colours with the same HSL numbers can look different in brightness to the human eye, because the eye is more sensitive to green than to blue. Use the swatch to check with your own eyes before you commit.
Frequently asked questions
What is the hex code for red? Pure red is HSL 0, 100, 50, which is hex #ff0000. A darker red is the same hue with lower lightness, for example HSL 0, 100, 30 gives #990000.
Why does my colour look grey? Because the saturation is low. At 0 percent saturation every colour is grey, and only the lightness changes. Raise the saturation to bring the colour back.
What is the difference between HSL and RGB? RGB mixes red, green and blue light, while HSL describes the colour, its strength and its brightness. They describe the same colours, but HSL is easier for people to pick and adjust.
Can I use the hex code in CSS? Yes. Write it as color: #6699cc or background-color: #6699cc. Every browser accepts hex codes, and every design tool accepts them too.
También disponible en español: Convertidor de HSL a Hex – Gratis, Instantáneo
