Convert HSL to HEX
Converting Hue, Saturation, Lightness (HSL) to hexadecimal (HEX) is a precise, rule-based operation — both formats describe the same color with different numbers. Whether you are tuning a CSS custom property, matching a brand color across design tools, or preparing values for print, this page gives you an interactive converter, the exact HSL → HEX method, a worked example, a quick-reference table and the details that matter (rounding, gamut and print caveats).
From
To
—
—
—
Live preview
How to convert HSL to HEX
Take this real example — the color firebrick(#c2410c):
hsl(17.47, 88.35%, 40.39%) → #c2410c
- Convert the HSL color to RGB using the HSL → RGB method.
- Keep the three RGB channels (0–255) — this is the shared numeric base of every on-screen format.
- Convert RGB to HEX with the RGB → HEX method to finish.
HSL → RGB → HEX (RGB is the numeric bridge)
HSL to HEX conversion table
| Color | HSL | HEX |
|---|---|---|
| White | hsl(0, 0%, 100%) | #ffffff |
| Black | hsl(0, 0%, 0%) | #000000 |
| Red | hsl(0, 100%, 50%) | #ff0000 |
| Lime | hsl(120, 100%, 50%) | #00ff00 |
| Blue | hsl(240, 100%, 50%) | #0000ff |
| VersatilBox accent | hsl(17.47, 88.35%, 40.39%) | #c2410c |
| Tailwind blue-500 | hsl(217.22, 91.22%, 59.8%) | #3b82f6 |
| Tailwind emerald-500 | hsl(160.12, 84.08%, 39.41%) | #10b981 |
About these formats
HSL (Hue, Saturation, Lightness). HSL is a cylindrical way of thinking about RGB that matches how humans adjust color: pick a hue angle, then dial saturation and lightness. Defined by CSS Color 4.
HEX (hexadecimal). HEX is the web's native notation: a # followed by two digits per channel in base 16 (00–FF). Compact, unambiguous and supported everywhere, from CSS to design tools.
Frequently asked questions
How do I convert HSL to HEX?
Convert the HSL color to RGB using the HSL → RGB method. Keep the three RGB channels (0–255) — this is the shared numeric base of every on-screen format. Convert RGB to HEX with the RGB → HEX method to finish. The converter above does it instantly, including the reverse direction.
What is HSL?
HSL — Hue, Saturation, Lightness — is a cylindrical way of thinking about RGB that matches how humans adjust color: pick a hue angle, then dial saturation and lightness. Defined by CSS Color 4.
What is HEX used for?
HEX (hexadecimal) is the web's native notation: a # followed by two digits per channel in base 16 (00–FF). Compact, unambiguous and supported everywhere, from CSS to design tools.
Is the HSL → HEX conversion exact?
Yes. The formulas are deterministic and both formats store the same information for on-screen color; values are rounded only for display.
Why does the HEX value look different in other tools?
Small differences come from rounding (how many decimals are kept) and from out-of-gamut handling. This site follows the CSS Color 4 algorithms and shows OKLCH with 3 decimals, the same convention used by browsers and mainstream design tools.