How to convert RGB to HSL
- Divide R, G and B by 255. Find the largest (max) and smallest (min).
- Lightness L = (max + min) ÷ 2.
- If max equals min the color is grey (H = 0, S = 0). Otherwise S = (max − min) ÷ (1 − |2L − 1|).
- Hue: if red is largest, H = 60 × ((G − B) ÷ (max − min) mod 6); if green, H = 60 × ((B − R) ÷ (max − min) + 2); if blue, H = 60 × ((R − G) ÷ (max − min) + 4).
When RGB to HSL helps
Image editors, screen color pickers and code often give colors as RGB. HSL is better for making changes you can predict: lowering saturation makes a color more muted, raising lightness makes it paler, and rotating the hue moves around the color wheel while keeping the same intensity.
This converter uses HSL for the harmony palettes too. A complementary color is the same saturation and lightness with the hue moved by 180 degrees, which is why converting to HSL is the first step in building color schemes.
HSL and HSV are not the same
HSL and HSV (also called HSB) both use a hue angle, but they measure the other two values differently. In HSL, 50% lightness gives the purest color; in HSV, 100% value does. Pure orange is hsl(24, 100%, 50%) but hsv(24, 100%, 100%). Photoshop and many color pickers use HSB, while CSS uses HSL, so make sure you copy the right one.
Reading the HSL result
The hue tells you the color family: around 0° is red, 30° orange, 60° yellow, 120° green, 180° cyan, 240° blue and 300° magenta. Saturation near 0% means the color is almost grey, and near 100% that it is vivid. Lightness near 0% is close to black and near 100% close to white, with the purest colors around 50%.
So rgb(255, 102, 0), which is hsl(24, 100%, 50%), reads as a fully saturated orange of medium lightness, the strongest version of that hue.
RGB to HSL chart of common colors
RGB to HSL values for common colors| Color | RGB | HSL |
|---|
| Black | rgb(0, 0, 0) | hsl(0, 0%, 0%) |
| White | rgb(255, 255, 255) | hsl(0, 0%, 100%) |
| Red | rgb(255, 0, 0) | hsl(0, 100%, 50%) |
| Lime | rgb(0, 255, 0) | hsl(120, 100%, 50%) |
| Blue | rgb(0, 0, 255) | hsl(240, 100%, 50%) |
| Yellow | rgb(255, 255, 0) | hsl(60, 100%, 50%) |
| Cyan | rgb(0, 255, 255) | hsl(180, 100%, 50%) |
| Magenta | rgb(255, 0, 255) | hsl(300, 100%, 50%) |
| Silver | rgb(192, 192, 192) | hsl(0, 0%, 75.3%) |
| Gray | rgb(128, 128, 128) | hsl(0, 0%, 50.2%) |
| Maroon | rgb(128, 0, 0) | hsl(0, 100%, 25.1%) |
| Olive | rgb(128, 128, 0) | hsl(60, 100%, 25.1%) |
| Green | rgb(0, 128, 0) | hsl(120, 100%, 25.1%) |
| Purple | rgb(128, 0, 128) | hsl(300, 100%, 25.1%) |
| Teal | rgb(0, 128, 128) | hsl(180, 100%, 25.1%) |
| Navy | rgb(0, 0, 128) | hsl(240, 100%, 25.1%) |
| Orange | rgb(255, 165, 0) | hsl(38.8, 100%, 50%) |
| Tomato | rgb(255, 99, 71) | hsl(9.1, 100%, 63.9%) |
Other colors: use the converter above or the Color Converter.