From HSL to the RGB values screens use
HSL is a friendly way to create colors: choose a hue on the color wheel, decide how strong it should be, and how light or dark. But some programs, image libraries and older systems only accept RGB or HEX values. This converter turns any HSL color into RGB and HEX and shows the full calculation so you can check it or learn the method.
How to use it
- Drag the Hue slider to choose the basic color (0° red, 120° green, 240° blue).
- Set Saturation: 0% is grey, 100% is the purest color.
- Set Lightness: 0% is black, 50% is the normal color and 100% is white.
- Copy the RGB or HEX result.
The HSL to RGB formula
With H in degrees and S and L as decimals between 0 and 1:
C = (1 − |2L − 1|) × S (chroma)
X = C × (1 − |(H / 60°) mod 2 − 1|)
m = L − C / 2
The hue decides which of six 60° segments the color is in, and that decides how C, X and 0 are given to red, green and blue. For example, from 0° to 60° the values are (C, X, 0), and from 180° to 240° they are (0, X, C). Finally, add m to each value and multiply by 255.
Worked example
For hsl(200, 80%, 45%): C = (1 − |0.9 − 1|) × 0.8 = 0.72. H / 60 = 3.33, so X = 0.72 × (1 − |1.33 − 1|) = 0.48. m = 0.45 − 0.36 = 0.09. 200° is in the 180° to 240° segment, so (r′, g′, b′) = (0, 0.48, 0.72). Adding m and multiplying by 255 gives RGB(23, 145, 207), which is #1791CF.
Frequently asked questions
Is HSL the same as HSV or HSB?
No. HSV (also called HSB) uses "value" instead of lightness. Pure colors are at 50% lightness in HSL but at 100% value in HSV, so the numbers are different.
Why are my results off by one?
Each step is rounded to whole numbers between 0 and 255, so different tools can differ by 1. You will not see the difference.
Can I convert RGB to HSL?
Yes, with our RGB to HSL converter.