# HSL to RGB Color Converter

URL: https://hifreetools.com/developer/hsl-to-rgb-converter

> Convert any HSL color value to its RGB equivalent instantly, with hex code output and a live color preview — no sign-up required.

## Quick answer

To convert HSL to RGB, normalize the saturation and lightness to 0–1, then use the chroma-based piecewise formula to calculate each channel. For example, HSL(0, 100%, 50%) converts to RGB(255, 0, 0) — pure red. The hue determines which 60° sector of the color wheel is active, saturation controls intensity, and lightness shifts the color toward black or white. The resulting RGB values each range from 0 to 255 and can be expressed as a hex code for use in CSS or design tools.

## Formula

- C = (1 − |2L − 1|) × S
- X = C × (1 − |H/60 mod 2 − 1|)
- m = L − C/2; (R, G, B) = (R' + m, G' + m, B' + m) × 255

## Examples

- Pure Red — HSL(0, 100%, 50%): H = 0°, S = 100%, L = 50% → RGB(255, 0, 0) — #ff0000
- Sky Blue — HSL(200, 80%, 60%): H = 200°, S = 80%, L = 60% → RGB(71, 180, 235) — #47b4eb
- Olive Green — HSL(80, 50%, 40%): H = 80°, S = 50%, L = 40% → RGB(119, 153, 51) — #779933
- Lavender Purple — HSL(270, 60%, 70%): H = 270°, S = 60%, L = 70% → RGB(179, 133, 224) — #b385e0

## FAQ

**What is the difference between HSL and RGB?**
RGB defines a color by its red, green, and blue light intensities (each 0–255). HSL describes the same color in human-readable terms: hue (the color wheel angle, 0–360°), saturation (color intensity, 0–100%), and lightness (brightness, 0–100%). Both represent the same color space; HSL is just more intuitive for designers.

**How do I use HSL values in CSS?**
CSS natively supports HSL with the syntax hsl(hue, saturation%, lightness%), for example hsl(200, 80%, 60%). You can also use the converted RGB values as rgb(71, 180, 235) or the hex code #47b4eb. All three forms produce the same color in the browser.

**What does a lightness of 0% or 100% mean?**
A lightness of 0% always produces black (RGB 0, 0, 0) regardless of hue or saturation, because no light is present. A lightness of 100% always produces white (RGB 255, 255, 255). The full range of hue and saturation only becomes visible at lightness values between these extremes.

**What does a saturation of 0% mean?**
When saturation is 0%, the color becomes a pure grayscale value determined entirely by lightness. For example, HSL(any, 0%, 50%) converts to RGB(128, 128, 128) — a medium gray. This is because with no saturation there is no chroma, so all three RGB channels are equal.

**Is HSL the same as HSB or HSV?**
No. HSL and HSB/HSV use similar hue and saturation concepts but define the third axis differently. HSB/HSV uses 'brightness' (maximum channel value), while HSL uses 'lightness' (average of max and min). A fully saturated, fully bright HSB color (S=100%, B=100%) is equivalent to HSL(h, 100%, 50%), not 100%.

**Can I convert back from RGB to HSL?**
Yes. To reverse the conversion, normalize RGB to 0–1, find the max and min channel values, compute lightness as (max+min)/2, then derive saturation from the chroma divided by (1−|2L−1|). Hue is calculated from which channel is dominant and the ratio of the other channels.


## Sources

- [W3C CSS Color Module Level 4 — Converting HSL colors to sRGB](https://www.w3.org/TR/css-color-4/#hsl-to-rgb)
- [Wikipedia — HSL and HSV](https://en.wikipedia.org/wiki/HSL_and_HSV)
- [MDN Web Docs — hsl()](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/hsl)

Runs in the browser; nothing is uploaded. Cite as: HIFreeTools, "HSL to RGB Color Converter", https://hifreetools.com/developer/hsl-to-rgb-converter
