Source format does not match the tool
Conversions fail when the pasted input is not actually in the expected source format.
Fix: Verify the source format first, then paste it into the correct converter.
header • up to 320x100 / 728x90
Convert HSL color to HEX
Translate HSL input into HEX with a clear form-based workflow.
content bottom • up to 300x250
sidebar • 160x600
Last reviewed:
HSL (Hue, Saturation, Lightness) is a color model built around how humans perceive color, making it intuitive for designers to pick and tweak shades.
HSL to HEX Converter takes an hsl() triple — hue in degrees, saturation and lightness as percentages — and returns the equivalent 6-digit hex code, or 8-digit hex when an alpha channel is provided via hsla().
The converter accepts both modern space-separated syntax (hsl(20 100% 63%)) and the legacy comma-separated form (hsl(20, 100%, 63%)), and gracefully handles hue values outside the 0–360° range by wrapping around the color wheel.
Paste your HSL input so it can be converted into HEX for your next step.
Get HEX output converted from HSL that is ready to review, copy, or export into the next step of your workflow.
Conversions fail when the pasted input is not actually in the expected source format.
Fix: Verify the source format first, then paste it into the correct converter.
Broken rows, missing fields, or incomplete markup can block conversion.
Fix: Use a complete input sample with the structure intact before converting it.
Different target formats can flatten, restructure, or serialize values differently.
Fix: Review the converted output and confirm it matches the target system before using it downstream.
Hue wraps around the color wheel — hsl(400 50% 50%) is treated as hsl(40 50% 50%) because 400° = 360° + 40°. Negative hue values wrap the other direction (hsl(-20) = hsl(340)). The tool normalizes the input and shows the effective hue so you can verify.
No. Saturation and lightness are clamped to 0–100% because values outside that range have no meaningful color representation. Out-of-range input is clipped with a visible warning so you know something was adjusted.
Yes, within rounding. DevTools uses the standard sRGB HSL-to-RGB conversion and then rounds each channel to the nearest integer; this tool follows the same algorithm, so the hex output matches byte-for-byte for any HSL that both sides round the same way.
The alpha is multiplied by 255 and rounded to the nearest integer. hsla(20 100% 63% / 0.5) becomes #ff804080 (0x80 = 128 = round(0.5 × 255)). The two-character alpha hex always appears as the last byte in the output.
Yes. The output is a standard CSS hex color, so it drops into styled-components template literals, Tailwind theme extensions, or design-token JSON files without modification. Nothing about the conversion introduces framework-specific syntax.
Within about ±0.5° of hue and ±0.5% of saturation/lightness, yes. The round-trip introduces minor rounding because hex has 256 discrete steps per channel while HSL is continuous — the drift is well below perceptual threshold.
Continue the workflow with related tools for hSL to HEX, adjacent input and output steps, or other utilities in the same category. You can also browse the full Color Converters category for more options.
Convert HEX color to HSL
Convert HSL color to RGB
Convert HEX color to HSV
Convert HEX color to RGB
Convert HSV color to HEX
Convert RGB color to HEX
Convert RGB color to HSL
Convert CMYK color to HEX
Convert HEX color to CMYK
Convert HEX color to OKLCH (CSS native)
Convert OKLCH color to HEX
Convert HSV color to RGB