Converters

RGB to HSL Converter

Convert any RGB color to HSL — hue, saturation and lightness — with exact precision. Live color preview, one-click copy for each channel and the full hsl() CSS value. Runs in your browser, no upload, no signup.

RGB input

Try an example:

#267D70
Live preview

HSL output

170°
53%
32%

CSS value

hsl(170, 53%, 32%)

How to convert RGB to HSL — the exact method

  1. Normalize R, G and B to the 0–1 range by dividing each by 255.
  2. Compute the maximum, minimum and delta of the three normalized channels.
  3. Lightness is the average of max and min.
  4. Saturation is derived from the delta and lightness (or the reciprocal).
  5. Hue is derived from which channel dominates, converted to degrees.

Example: rgb(38, 125, 112) → hsl(170°, 53%, 32%).

Quick RGB to HSL reference chart

ColorRGBHSL
Red255, 0, 0hsl(0, 100%, 50%)
Yellow255, 255, 0hsl(60, 100%, 50%)
Green0, 255, 0hsl(120, 100%, 50%)
Cyan0, 255, 255hsl(180, 100%, 50%)
Blue0, 0, 255hsl(240, 100%, 50%)
Magenta255, 0, 255hsl(300, 100%, 50%)
White255, 255, 255hsl(0, 0%, 100%)
Black0, 0, 0hsl(0, 0%, 0%)
Teal (brand)38, 125, 112hsl(170, 53%, 32%)

Why designers convert RGB to HSL

  • Hover and pressed states — adjust only lightness to keep hue and saturation consistent.
  • Palette generation — hue rotation in HSL is what powers complementary, analogous and triadic palettes.
  • Readable tokens — HSL communicates intent better than raw channel numbers.
  • Programmatic theming — CSS custom properties with HSL values can be manipulated with calc().

FAQ

How do I convert RGB to HSL?
Normalize each channel to 0–1, compute max, min and delta, then derive hue, saturation and lightness using the standard CSS Color Module Level 3 formula.
What is the difference between HSL and HSV?
HSL uses lightness and is designed for CSS; HSV (also called HSB) uses value and is common in design software. They are not interchangeable — the same numbers produce different colors.
Is RGB to HSL conversion lossless?
Yes. HSL is computed from exact RGB values, and round-tripping reproduces the original RGB with consistent rounding.
Can I use hsl() in CSS?
Yes. hsl() is supported in every modern browser and is a standard CSS Color Module Level 3 function.
Can I use HSL for accessibility contrast checks?
You can, but WCAG contrast is computed from relative luminance, not HSL. Use our Contrast Checker for WCAG-compliant evaluation.
Is the tool free and private?
Yes. Free, no signup, all processing in your browser. Nothing is uploaded.

Related tools

Related articles