How HSL to HSV conversion works
HSL and HSV share the same hue, so converting between them only remaps the other two numbers. HSL measures lightness from black to white with the purest colour at 50%; HSV measures value from black to the purest colour at 100%. Saturation is redefined to match.
- Scale S and L to 0–1. Hue stays the same.
- V = L + S × min(L, 1 − L).
- S(HSV) = 0 if V = 0, otherwise 2 × (1 − L ÷ V).
- Report H in degrees and S(HSV), V in percent.
Worked example: hsl(120, 60%, 40%) to HSV
Here is the converter's own calculation for hsl(120, 60%, 40%), step by step. The result, hsv(120, 75%, 64%), is exactly what the tool above shows for this input.
- Chroma C = (1 − |2 × 0.4 − 1|) × 0.6 = 0.48.
- X = 0.48 × (1 − |(120 ÷ 60) mod 2 − 1|) = 0.
- m = 0.4 − 0.48 ÷ 2 = 0.16.
- 120° is in the 120–180° sector, so (R′, G′, B′) = (X, C, X) = (0, 0.48, 0).
- Add m and multiply by 255: R = 41, G = 163, B = 41.
- R′ = 41 ÷ 255 = 0.161, G′ = 0.639, B′ = 0.161.
- Cmax = 0.639, Cmin = 0.161, Δ = 0.478.
- V = Cmax = 0.639.
- S = Δ ÷ V = 0.748.
- Green is largest: H = 60° × ((0.161 − 0.161) ÷ 0.478 + 2) = 120°.
- Rounded:
hsv(120, 75%, 64%).
Same hue, different saturation and lightness in HSL and HSV
Hue 120° (green) at a grid of values, to show how the two saturation scales diverge.
| Colour | HSL | HSV |
|---|---|---|
| S 100%, 25% | hsl(120, 100%, 25%) | hsv(120, 100%, 50%) |
| S 100%, 50% | hsl(120, 100%, 50%) | hsv(120, 100%, 100%) |
| S 100%, 75% | hsl(120, 100%, 75%) | hsv(120, 50%, 100%) |
| S 100%, 90% | hsl(120, 100%, 90%) | hsv(120, 20%, 100%) |
| S 50%, 25% | hsl(120, 50%, 25%) | hsv(120, 67%, 38%) |
| S 50%, 50% | hsl(120, 50%, 50%) | hsv(120, 66%, 75%) |
| S 50%, 75% | hsl(120, 50%, 75%) | hsv(120, 29%, 87%) |
| S 20%, 50% | hsl(120, 20%, 50%) | hsv(120, 33%, 60%) |
| S 20%, 85% | hsl(120, 20%, 85%) | hsv(120, 7%, 88%) |
Precision test: every HSL value through the converter
This is the pair where rounding bites hardest in both directions: of the 3,672,360 whole-number HSL values, 24.346% come back exactly after HSL → HSV → HSL, with drift of up to 3 RGB levels (#F6C8C6 → #F5C5C4). The two grids don't line up, so most whole-number HSL colours sit between whole-number HSV ones.
Method: every whole-number HSL value, through the converter's own code and back, compared on the 0–255 scale (how we test).
| Measure | Result |
|---|---|
| HSL values tested | 3,672,360 |
| Distinct HSV results | 1,609,995 |
| Came back exactly | 24.346% |
| Largest change (0–255 levels) | 3 |
| Average change | 0.7999 |
Last updated · Source: Pixohub exhaustive test of lib/color-math.ts
Where you'll use HSL to HSV
Moving a colour from CSS into a picker
Stylesheets use HSL, while Photoshop, Procreate and Figma's HSB mode use HSV. Converting tells you exactly where to place the brightness slider.
Explaining saturation differences
The grid below shows the same hue at several HSL saturation and lightness values with their HSV equivalents. Light tints have low HSV saturation but can be 100% saturated in HSL.
Porting colour logic between libraries
Code written against an HSL helper (CSS, chroma.js) and code using HSV (OpenCV, Unity) often need the same colour in both.
Common mistakes
- Copying S across unchanged: hsl(120, 60%, 40%) and hsv(120, 60%, 40%) are different greens.
- Assuming V and L are both "brightness": white is L = 100% but V = 100% with S = 0%.
- Converting back and forth repeatedly with rounding, which drifts the colour.
- Forgetting that at L = 0% (black) saturation is undefined in both models.