Result
All calculations run locally in your browser: parsing, chart, export. Disconnect the network and the page keeps working.
Facts and limits of this method
| Each channel's range | 0 to 255 inclusive |
|---|---|
| Hue (H) | 0 to 360 degrees |
| Saturation and lightness | 0% to 100% |
| Rounding | Every RGB and result value is rounded to a whole number |
When it misleads you
- Values outside the 0–255 range are automatically clamped to those bounds rather than rejected with an error.
- For pure gray colors (R=G=B), saturation is zero and hue is mathematically undefined — the converter shows 0° in this case, a convention rather than a meaningful value.
- Rounding input RGB values to whole numbers before the calculation can cause very close but not identical grays to produce the same HSL result.
- The result is just another way of writing the same numbers, not a different color space — HSL carries no extra color-profile information compared to RGB.
How it is calculated
R, G and B values are normalized to the 0–1 range by dividing by 255.
Lightness is computed as the average of the highest and lowest of the three channels.
If the max and min are equal, saturation and hue are zero (gray); otherwise saturation is computed from the difference between max and min relative to lightness, and hue from which channel came out highest.
The resulting fractions are converted to degrees (0–360) and percent (0–100) and rounded to whole numbers.
Questions and answers
Why is the hue 0° for a gray color?
At zero saturation, hue is mathematically undefined — 0° is just a convention, any hue value looks the same at that saturation.
Is HSL more accurate than RGB?
No, it's just another way to describe the same color — both formats define the same point in color space.
Can I enter fractional RGB values?
Yes, but they're rounded to the nearest whole number in the 0–255 range before the calculation.
Is my data sent anywhere?
No, the whole calculation runs in your browser.