HSL to RGB Color 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 & method
C = (1 β |2L β 1|) Γ S
- C β Chroma β the range of the color
- L β Lightness (0 to 1)
- S β Saturation (0 to 1)
Chroma (color intensity). L and S are normalized to 0β1.
X = C Γ (1 β |H/60 mod 2 β 1|)
- X β Intermediate component value
- H β Hue in degrees (0β360)
- C β Chroma
Intermediate value for the second-largest RGB component.
m = L β C/2; (R, G, B) = (R' + m, G' + m, B' + m) Γ 255
- m β Match value β shifts brightness to target lightness
- R', G', B' β Preliminary RGB components from the H/C/X sector
Add the match value m to each preliminary channel, then scale to 0β255.
Examples
- Input
- H = 0Β°, S = 100%, L = 50%
- Result
- RGB(255, 0, 0) β #ff0000
- Why
- With H=0, S=1, L=0.5: C = (1β|2Γ0.5β1|)Γ1 = 1, m = 0.5β0.5 = 0. H falls in the 0β60Β° sector so R'=1, G'=0, B'=0. Final: R=255, G=0, B=0.
- Input
- H = 200Β°, S = 80%, L = 60%
- Result
- RGB(71, 180, 235) β #47b4eb
- Why
- S=0.8, L=0.6: C=(1β|1.2β1|)Γ0.8=0.64, m=0.6β0.32=0.28. H=200 falls in 180β240Β° sector giving R'=0, G'=Xβ0.436, B'=0.64. Adding m and scaling: Rβ71, Gβ180, Bβ235.
- Input
- H = 80Β°, S = 50%, L = 40%
- Result
- RGB(119, 153, 51) β #779933
- Why
- S=0.5, L=0.4: C=(1β|0.8β1|)Γ0.5=0.4, m=0.4β0.2=0.2. H=80 falls in 60β120Β° sector giving G'=0.4, R'=Xβ0.267, B'=0. Adding m and scaling: Rβ119, Gβ153, Bβ51.
- Input
- H = 270Β°, S = 60%, L = 70%
- Result
- RGB(179, 133, 224) β #b385e0
- Why
- S=0.6, L=0.7: C=(1β|1.4β1|)Γ0.6=0.36, m=0.7β0.18=0.52. H=270 falls in 240β300Β° sector giving B'=0.36, R'=Xβ0.18, G'=0. Adding m and scaling: Rβ179, Gβ133, Bβ224.
Frequently asked questions
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 & references
- https://www.w3.org/TR/css-color-4/#hsl-to-rgb
- https://en.wikipedia.org/wiki/HSL_and_HSV
- https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/hsl
External references open in a new tab. We are independent and not affiliated with these organizations.
- β Free to use
- β No sign-up required
- β Runs entirely in your browser β nothing is uploaded.
- β Formula and method shown above
Provided βas isβ for general information only β results may be inaccurate, so verify before you rely on them. No warranty; use at your own risk.
Built and reviewed by HIFreeTools against the formula shown above and any authoritative references cited on this page. See our methodology and editorial standards.
Related tools
- Scientific CalculatorScience & Engineering
- Logarithm CalculatorCalculators
- Fraction CalculatorCalculators
- Quadratic Formula CalculatorCalculators
Embed this tool on your site
Free to embed, no sign-up. Paste this code where you want the hsl to rgb color converter to appear: