About the RGB to HSL
HSL describes color in terms people find intuitive: the hue on a color wheel, how vivid it is, and how light or dark. Type an rgb() value, a HEX code or an hsl() value and this tool shows all the formats together, with a preview, contrast checks and color harmonies.
How it works
The red, green, and blue values are divided by 255 so they fall between 0 and 1. Lightness is the average of the largest and smallest of the three. If all three are equal, the color is a gray with 0% saturation and a hue of 0.
Otherwise, saturation is the spread between the largest and smallest channel divided by a factor that depends on whether lightness is above or below 50%. Hue is found from which channel is largest and the relative size of the other two, expressed as an angle from 0 to 360 degrees, where 0 is red, 120 is green, and 240 is blue. The tool rounds hue to whole degrees and saturation and lightness to whole percentages.
How to use
- 1
Type an rgb() value or HEX code into the Color field, or click the swatch to pick a color.
- 2
Read the HSL row for hue, saturation, and lightness.
- 3
Click the copy icon to copy the hsl() value.
Worked examples
Emerald green
Getting HSL so you can make a darker hover color.
Green is the largest channel, so the hue lands in the green-cyan part of the wheel at 160 degrees.
Bright blue
Converting a primary button color.
Mid gray
Seeing how a neutral color looks in HSL.
Equal channels mean no saturation, so hue is reported as 0.
Frequently asked questions
Why would I prefer HSL over RGB for adjusting a color?+
In HSL you can change lightness or saturation with one number, while in RGB you would need to recalculate all three channels to get the same effect.
What does the hue value represent?+
Hue is an angle from 0 to 360 degrees on the color wheel. 0 is red, 120 is green, and 240 is blue.
Why is the hue 0 for gray, black, and white?+
When red, green, and blue are equal, the color has no saturation, so hue has no effect and the tool reports it as 0.
How do I enter RGB values directly?+
Open the color picker by clicking the swatch. Many browsers let you switch the picker to RGB and type the numbers. You can also convert RGB to HEX first and paste the HEX code.
Can I use the hsl() output directly in CSS?+
Yes. The output is written as hsl(h, s%, l%), which every modern browser accepts.