HSL to RGB Converter
Enter hue, saturation and lightness and read the red, green and blue channels. hsl(39, 100%, 50%) becomes rgb(255, 166, 0).
#FFA600closest CSS name: orange
For example hsl(210, 100%, 56%)
For example rgb(30, 144, 255) or 30 144 255
Closest CSS color orange #FFA500
Pick visually and see the other formats
Use 3 or 6 digits, for example #1E90FF or 19F
For example cmyk(88%, 44%, 0%, 0%)
Recent colors
Colors you pick appear here. They stay on this device.
By the Hex Color Picker Team. Updated
How to convert HSL to RGB
- Type the value as hsl(39, 100%, 50%) into the HSL box, with percent signs on saturation and lightness.
- Copy the rgb() value from the RGB box.
- If you have RGB and want HSL, edit the RGB box instead. The conversion runs both ways.
The math, step by step
Chroma is the color's strength: C = (1 - |2L - 1|) x S. For hsl(39, 100%, 50%), L = 0.5 and S = 1, so C = 1. Divide the hue by 60 to find its slice of the wheel: 39 / 60 = 0.65. Within a slice, one channel gets the full chroma, one gets X = C x (1 - |slice mod 2 - 1|), and one gets zero. Here X = 0.65, so red = 1, green = 0.65 and blue = 0.
Add m = L - C / 2 (zero here), multiply by 255 and round: rgb(255, 165.75, 0) becomes rgb(255, 166, 0).
Why that isn't quite CSS orange
The named color orange is rgb(255, 165, 0). The HSL value that rounds to it, hsl(39, 100%, 50%), converts to a green of 166, one step higher. That's rounding in the HSL values, and the difference is invisible. It's also why hex or RGB is the better format to store a color exactly, with HSL used to adjust it.
Greys and the edge cases
- With 0% saturation the hue has no effect: hsl(0, 0%, 75%) is rgb(191, 191, 191) for any hue.
- Lightness 0% always gives black and 100% always gives white, whatever the hue and saturation.
- A hue of 360 is the same as 0. Values past 360 wrap around the wheel.
When you need RGB numbers
CSS can use hsl() directly, so you rarely need to convert for styling alone. RGB numbers are useful when a library or tool asks for channels from 0 to 255: image-processing code, canvas pixel data, game engines and many design plugins. They are also the easiest format for checking contrast, since the WCAG formula starts from the red, green and blue values. Convert here, then paste the three numbers where they're needed.
Common questions
What range does the hue accept?
Hue is in degrees. 0 to 360 covers the wheel, and values outside that range wrap around, so 400 is the same as 40.
Can I use decimals in saturation and lightness?
Yes. Values like 44.5% are accepted, and the rgb() result is rounded to whole channel values.