🌈 RGB to HSL Converter

Convert RGB color values to HSL and back. Precise color space conversion.

RGB → HSL

Enter RGB and click Convert.


Reverse: HSL → RGB

About the RGB to HSL Converter

This tool converts RGB color values (0–255 per channel) into HSL (Hue, Saturation, Lightness) values, and converts HSL back to RGB. All math runs in your browser — no data leaves your device.

RGB vs. HSL

RGB describes a color by the intensity of its red, green and blue components. HSL describes a color by its position on the color wheel (hue), how colorful it is (saturation), and how light it is (lightness). HSL is far more intuitive when you want to create tints, shades, or harmonious color schemes.

The math behind it

RGB is normalized to 0–1, then the maximum and minimum channel values are found. Lightness is the average of max and min. If max and min differ, saturation and hue are derived from the difference. To convert back, hue is divided into six sectors and each channel is reconstructed using piecewise linear interpolation.

Frequently asked questions

Are negative or out-of-range values accepted? No. Each input is clamped to its valid range (R/G/B 0–255, H 0–360, S/L 0–100).

Why are the HSL values rounded? The display is rounded for readability, but the underlying math is exact until the final integer step.

Is the reverse conversion lossless? Not always — HSL has fewer representable hues than RGB, so some round trips produce a slightly different RGB triplet. This is expected.