HEX To HSL
Reverse Conversion
How This Converter Works
Converts a six-digit hexadecimal RGB color, optionally prefixed with #, to hue, saturation, and lightness.
Formula or rule
Normalize RGB to [0,1]; max and min define L=(max+min)/2, delta=max-min, S=delta/(1-|2L-1|), and hue is 60° times the channel difference for the maximum channel, wrapped to 0–360°.
Example
- Input
- #FF8000
- Calculation
- Normalized RGB=(1, 0.502, 0); max=R, delta=1; H=60×(0.502-0)/1≈30.1°; L=(1+0)/2=0.5; S=1/(1-|2×0.5-1|)=1.
- Result
- hsl(30, 100%, 50%)