HEX to HSL Converter
Convert a three- or six-digit sRGB hex code to HSL and RGB values.
Formula and sources updated · Data sources · 1View algorithm, constants and default inputs (JSON)
About this calculator
Enter a three- or six-digit sRGB hex colour such as #3B82F6. Alpha-channel forms are not accepted because this page reports opaque RGB and HSL values.
Worked example
calculated with the default values below
HEX colour #3B82F6 HSL hsl(217, 91%, 60%) · HSL hsl(217, 91%, 60%) · Hue 217 ° · Saturation 91.2 % · Lightness 59.8 % · RGB 59, 130, 246
Method and assumptions
L = (M + m) ÷ 2; S = Δ ÷ (1 − |2L − 1|); H → 60° × ((G−B)/Δ mod 6 (R = M) | (B−R)/Δ + 2 (G = M) | (R−G)/Δ + 4 (B = M)) R,G,B are 0–1; when Δ = 0, H = S = 0; S and L are reported as percentages. Enter a three- or six-digit sRGB hex colour such as #3B82F6. Alpha-channel forms are not accepted because this page reports opaque RGB and HSL values. The references explain definitions and methods; any extra preset must be checked against the assumptions on this page.
Data sources
The references explain definitions and methods; any extra preset must be checked against the assumptions on this page.
Disclaimer
These calculators give general conversion results. Rounding and the precision of the value you enter both affect the output, so treat displayed decimals as indicative rather than exact.
Implementation source
This record describes the implementation used by this page. It is not independent validation. External references, when available, support only the stated formula or definition; estimates and custom rules retain their own assumptions.
Formula and variables
L = (M + m) ÷ 2; S = Δ ÷ (1 − |2L − 1|); H → 60° × ((G−B)/Δ mod 6 (R = M) | (B−R)/Δ + 2 (G = M) | (R−G)/Δ + 4 (B = M))
- R,G,B
- normalised channels (0–1)
- M
- max(R, G, B)
- m
- min(R, G, B)
- Δ
- M − m
- H,S,L
- hue °, saturation, lightness
R,G,B are 0–1; when Δ = 0, H = S = 0; S and L are reported as percentages.
Frequently asked questions
Which HEX formats are accepted?
Enter a three- or six-digit sRGB hex colour such as #3B82F6. Alpha-channel forms are not accepted because this page reports opaque RGB and HSL values.
Which inputs and limits apply to HEX to HSL Converter?
Use the units shown beside each field. These are form limits, not recommended settings. L = (M + m) ÷ 2; S = Δ ÷ (1 − |2L − 1|); H → 60° × ((G−B)/Δ mod 6 (R = M) | (B−R)/Δ + 2 (G = M) | (R−G)/Δ + 4 (B = M)) R,G,B are 0–1; when Δ = 0, H = S = 0; S and L are reported as percentages. Enter a three- or six-digit sRGB hex colour such as #3B82F6. Alpha-channel forms are not accepted because this page reports opaque RGB and HSL values. The references explain definitions and methods; any extra preset must be checked against the assumptions on this page.
What is a complete worked example for HEX colour = #3B82F6?
Inputs: HEX colour = #3B82F6. Calculation: L = (M + m) ÷ 2; S = Δ ÷ (1 − |2L − 1|); H → 60° × ((G−B)/Δ mod 6 (R = M) | (B−R)/Δ + 2 (G = M) | (R−G)/Δ + 4 (B = M)). Results: HSL = hsl(217, 91%, 60%); Hue = 217 °; Saturation = 91.2 %; Lightness = 59.8 %; RGB = 59, 130, 246.