Enter red, green, and blue values from 0 to 255 below to see the equivalent hsl() string update live. This is handy for generating consistent tints and shades, and it all runs locally with nothing uploaded.

HSLhsl(238, 100%, 71%)
Worked RGB to HSL conversions
RGBHueSaturationLightness
255, 0, 0100%50%
0, 128, 0120°100%25%
108, 114, 255237°100%71%
128, 128, 1280%50%
26, 147, 111157°70%34%
Worked example
rgb(108, 114, 255)hsl(237, 100%, 71%)

The three channels are normalised, then mapped onto hue, saturation, and lightness.

Frequently asked questions

How do you calculate HSL from RGB?

Divide each channel by 255, find the maximum and minimum, and use them to compute lightness as the midpoint, saturation from their difference, and hue from which channel is largest. The results are scaled to degrees and percentages.

When is RGB to HSL conversion useful?

It is ideal for building color systems — once you have HSL you can generate consistent tints (raise lightness), shades (lower lightness), or analogous hues (rotate the hue) from a single base color.

Why is saturation 0% for grays?

When red, green, and blue are equal there is no dominant hue, so saturation is zero and only lightness varies. That is why all grays share 0% saturation.

Does this leave my browser?

No. The conversion is performed in JavaScript on your device with no network request.

Related conversions

Need more options? Try the full Color Picker.