Connect via MCP →

Enter Calculation

Formula

Advertisement

Results

RGB Color
rgb(64, 128, 191)
Red 64
Green 128
Blue 191

What is the HSL to RGB Converter?

This tool converts a color expressed in the HSL model — Hue, Saturation, and Lightness — into the RGB model used by screens, CSS, and image files. HSL is intuitive for designers because it separates the "color" (hue) from how vivid (saturation) and how bright (lightness) it is, while RGB describes the same color as amounts of red, green, and blue light. The conversion is exact and works for any valid HSL input.

HSL cylinder color model with hue around the circle, saturation toward the edge, lightness vertical
The HSL color model: hue (angle), saturation (radius) and lightness (height).

How to use it

Enter the hue in degrees (0–360), saturation as a percentage (0–100), and lightness as a percentage (0–100). The calculator returns the equivalent rgb(r, g, b) values, each from 0 to 255, plus a live color swatch so you can confirm the result visually.

The formula explained

First the saturation and lightness are scaled to the 0–1 range. Chroma is \(C = (1 - |2L - 1|)\,S\), the colorfulness of the result. A helper value \(X = C\left(1 - \left|\left(\tfrac{H}{60}\bmod 2\right) - 1\right|\right)\) handles the intermediate blend within each 60° hue sextant, and \(m = L - \tfrac{C}{2}\) shifts everything to match the requested lightness. Depending on which 60° sector the hue falls in, C, X, and 0 are assigned to R, G, and B in a specific order, then m is added and each channel is multiplied by 255 and rounded.

$$C = (1 - |2L - 1|)\,S,\quad X = C\left(1 - \left|\left(\tfrac{H}{60}\bmod 2\right) - 1\right|\right),\quad m = L - \tfrac{C}{2}$$$$(R,G,B) = \big((R'+m)\cdot 255,\ (G'+m)\cdot 255,\ (B'+m)\cdot 255\big)$$
Triangular saturation-lightness slice showing how C, X and m map onto RGB channels
How the intermediate values C, X and m build each RGB channel.

Worked example

For HSL(210°, 50%, 50%): \(S = 0.5\), \(L = 0.5\).

$$C = (1 - |0|)\cdot 0.5 = 0.5$$

\(H/60 = 3.5\), so \((3.5 \bmod 2) = 1.5\) and

$$X = 0.5\cdot(1 - |1.5 - 1|) = 0.25$$$$m = 0.5 - 0.25 = 0.25$$

Hue 210° is in sector 3 (180–240°), giving \((R',G',B') = (0, X, C) = (0, 0.25, 0.5)\). Adding m and ×255: \(R = 64\), \(G = 128\), \(B = 191\) → rgb(64, 128, 191).

Color swatch showing an HSL input converting to its RGB output
A single color shown as its HSL inputs and the resulting RGB output.

FAQ

What ranges do the inputs use? Hue is 0–360 degrees; saturation and lightness are 0–100 percent.

Why are values rounded? RGB channels must be whole numbers from 0 to 255, so the scaled result is rounded to the nearest integer.

Is gray possible? Yes — set saturation to 0 and any hue, and R, G, and B will all equal the lightness value scaled to 0–255.

Last updated: