RGB to HSL Converter
Convert colours between RGB and HSL using the standard sRGB formulas: hue in degrees, saturation and lightness with configurable decimals, accepts rgb(), bare numbers, percentage channels, HEX and hsl() for the reverse direction, with batch input and live preview.
Runs in your browserEvery computation happens in your browser — your data never leaves this device.
Accepts rgb()/rgba(), percentage channels, bare numbers, #f00 / #ff0000 / #ff0000ff, plus hsl()/hsv()/cmyk().
Result
One result per line, ready to paste into CSS.
Enter a colour to see the result
What this tool does
- Turn RGB values into HSL so a palette can be adjusted by hue and saturation instead of by trial and error.
- Work in reverse: convert hsl() back to RGB or HEX to check it against a design file.
- Keep more precision when a CSS variable needs it by raising the decimal places for hue and percentages.
Example
Input
rgb(51, 102, 153)
Output
hsl(210, 50%, 40%)
The conversion uses the standard sRGB → HSL formulas: L = (max + min) / 2 and S = (max − min) / (1 − |2L − 1|).
Frequently asked questions
How does HSL differ from HSV?
In HSL the L axis is lightness, so a pure hue such as #ff0000 sits at 50%; in HSV the V axis is brightness and the same colour sits at 100%. Hue is identical in both, so pick whichever your design tool uses.
Why is there no hue for grey?
When max equals min the chroma is zero and hue is mathematically undefined, so it is reported as 0° with 0% saturation. That is why #808080 gives hsl(0, 0%, 50.2%).
Are the numbers rounded?
Not to whole numbers. Hue and percentages keep 1 decimal by default (50.2%, 66.7%) and you can choose 0–4. Rounding only affects the printed text; the reverse conversion uses the parsed values.
Can I convert several colours at once?
Yes. Enter one colour per line; blank lines are skipped and unparsable lines are listed with an error code without affecting the others.
Keywords:rgb2hslrgb to hslhsl to rgbcolor converter