- Home
- Tools
- Color & Design
- Color Converter
- HSL to RGB Converter
HSL to RGB Converter
Convert a hue, a saturation and a lightness to red, green and blue values from 0 to 255.
The numbers alone will do: 200, 60, 50.
In RGB
rgb(51, 153, 102)
Hue
150°Alpha
100%
In the other notations
Name
seagreennearest CSS name, #2e8b57
HSL to RGB by hand
The converter opens with hsl(150, 50%, 40%). This is how that color gets from HSL to RGB, step by step.
- Write the two percentages as fractions: S = 0.5 and L = 0.4.
- Chroma is how far the strongest channel will be from the weakest: C = (1 − |2 × L − 1|) × S = (1 − |2 × 0.4 − 1|) × 0.5 = 0.4.
- Divide the hue by 60° to see which sixth of the color wheel it is in: 150 ÷ 60 = 2.5. A number from 2 to 3 lies between green and cyan.
- There green is the strongest channel and gets C, red is the weakest and gets 0, and blue lies in between with X = C × (1 − |2.5 mod 2 − 1|) = 0.4 × 0.5 = 0.2.
- Add m = L − C ÷ 2 = 0.4 − 0.2 = 0.2 to all three, so that the lightness comes out right: red 0.2, green 0.6 and blue 0.4.
- Multiply by 255 and round: 51, 153 and 102.
- Written the CSS way:
rgb(51, 153, 102).
Well-known colors in HSL and RGB
| Color | HSL | RGB |
|---|---|---|
| black | hsl(0, 0%, 0%) | rgb(0, 0, 0) |
| white | hsl(0, 0%, 100%) | rgb(255, 255, 255) |
| gray | hsl(0, 0%, 50.2%) | rgb(128, 128, 128) |
| red | hsl(0, 100%, 50%) | rgb(255, 0, 0) |
| orange | hsl(38.8, 100%, 50%) | rgb(255, 165, 0) |
| yellow | hsl(60, 100%, 50%) | rgb(255, 255, 0) |
| lime | hsl(120, 100%, 50%) | rgb(0, 255, 0) |
| green | hsl(120, 100%, 25.1%) | rgb(0, 128, 0) |
| cyan | hsl(180, 100%, 50%) | rgb(0, 255, 255) |
| blue | hsl(240, 100%, 50%) | rgb(0, 0, 255) |
| purple | hsl(300, 100%, 25.1%) | rgb(128, 0, 128) |
| magenta | hsl(300, 100%, 50%) | rgb(255, 0, 255) |
Rounding, and the cousin HSV
- The three results are rounded to whole numbers, because a screen has 256 levels for each channel. Two HSL colors that differ only a little can therefore give the same RGB values:
hsl(150.2, 50%, 40%)isrgb(51, 153, 102)as well. - With a saturation of 0% the hue drops out. C is 0, and all three channels equal the lightness.
- HSV, which design programs often call HSB, is converted with the same steps and two other formulas: C = V × S, and the amount added at the end is m = V − C.
The color converter shows a color in all seven notations at once, with a picker to choose it by eye.