My Tool Studio
Color

HSL to HEX

Theme math happens in HSL, but tokens files, email templates, and older tools still want hex. When your palette logic produces hsl(152, 60%, 40%) and the deliverable needs a six-character code, this hsl to hex converter closes the gap: type the value and the highlighted HEX row answers #29A36A. Input goes in the hsl(h, s%, l%) form, with hue as a bare number and saturation and lightness as percentages. It's the tool you want when a designer specs colors as hue and lightness pairs, or when you've generated a lightness ramp programmatically and need to freeze each step as a concrete code. You can convert hsl to hex online here with RGB, HSV, CMYK, and OKLCH thrown in.

Always freeNo sign upRuns in your browser
hex#6467F2
rgbrgb(100, 103, 242)
hslhsl(239, 85%, 67%)
hsvhsv(239, 59%, 95%)
cmykcmyk(59%, 57%, 0%, 5%)
oklchoklch(58.85% 0.2 277.19deg)

How to use

01

Write the HSL value

Fill the Input (HSL) field using the pattern hsl(h, s%, l%). The percent signs on saturation and lightness matter for parsing. The field is preloaded with hsl(239, 84%, 67%) to show the shape.

02

Watch the swatch update

Each keystroke re-renders the preview swatch once the string parses. If the warning about an unparseable format appears, check that both percentages carry their percent sign.

03

Take the hex from the top row

The results grid highlights HEX as the primary format for this tool. Hit its copy button for an uppercase code you can paste into a tokens file, a brand doc, or an email template.

Why HSL to HEX

Common questions

What hex code does hsl(152, 60%, 40%) produce?
It converts to #29A36A, a medium green. Behind the scenes the hue and saturation are resolved into red, green, and blue channels of 41, 163, and 106, and each channel is then written as a two-digit hex pair.
Why doesn't my HSL round-trip back to the exact original hex?
Whole-number HSL is coarser than 8-bit RGB. Take #6366F1: it converts to hsl(239, 84%, 67%), but feeding that back in yields #6467F2, one digit off per channel. Keep the hex as your source of truth when exact codes matter.
How should I format the input for the HSL to HEX tool?
Stick to hsl(h, s%, l%), for example hsl(152, 60%, 40%). Hue is a plain number of degrees with no unit, while saturation and lightness both need percent signs. Leaving off a percent sign is the most common parse failure.
Can hue values above 360 still convert to a hex code?
Hue is circular, so 512 degrees describes the same angle as 152 degrees. Most parsers wrap large values around the wheel, but writing hues in the 0 to 360 range keeps your inputs readable and predictable.
Does lightness 0% or 100% always give #000000 or #FFFFFF?
Yes, regardless of the hue and saturation you supply. Lightness is the dominant axis: at the extremes every hue collapses to pure black or pure white, which is why usable palette steps usually live between roughly 10 and 95 percent.
Is there a way to darken a color before grabbing the hex?
Just lower the lightness number in the input. Dropping hsl(152, 60%, 40%) to hsl(152, 60%, 32%) yields #218355, a convincing pressed-button shade of the same green. Adjusting the L channel beats eyeballing a darker hex every time.

More Color tools

View all