HSL to Hex Converter
Enter an hsl() value and get the hex code to copy. hsl(282, 44%, 53%) becomes #9C52BC. Use it when a design gives you HSL but your tool or style guide wants hex.
#9C52BCclosest CSS name: mediumorchid
For example hsl(210, 100%, 56%)
Use 3 or 6 digits, for example #1E90FF or 19F
Closest CSS color mediumorchid #BA55D3
Pick visually and see the other formats
For example rgb(30, 144, 255) or 30 144 255
For example cmyk(88%, 44%, 0%, 0%)
Recent colors
Colors you pick appear here. They stay on this device.
By the Hex Color Picker Team. Updated
How to convert HSL to hex
- Type the value as hsl(282, 44%, 53%), with the percent signs, into the HSL box.
- Copy the six-digit hex code from the hex box.
- Edit the hex box if you'd rather start from a code: the HSL values update to match.
The math, step by step
First work out chroma, the color's strength: (1 - |2 x lightness - 1|) x saturation. For lightness 53% and saturation 44% that is (1 - 0.06) x 0.44, about 0.41. Next, find where the hue sits within its 60-degree slice of the wheel to decide which channel gets the full chroma, which gets a fraction, and which gets none. Finally, add (lightness - chroma / 2) to every channel to bring the color to the right lightness.
Scale the three results to 0-255 and write each as two hex digits. For hsl(282, 44%, 53%) that gives rgb(156, 82, 188) and the code #9C52BC.
Why a round trip can shift a digit
HSL values are normally written as whole numbers, but there are far more hex colors than there are whole-number HSL values. Converting #1E90FF to hsl(210, 100%, 56%) and then back gives #1F8FFF: one step off in red and green, which the eye can't see. If you need the exact original color, keep the hex code and treat HSL as a working format.
What the result is good for
Design systems often define colors in HSL because the scales are easy to reason about, then export hex for tools that don't read hsl(). This converter bridges the two directions without a spreadsheet.
Writing the HSL value
The converter accepts commas or spaces between the numbers, and an optional deg after the hue, so hsl(282, 44%, 53%), hsl(282 44% 53%) and hsl(282deg, 44%, 53%) all give the same result. Saturation and lightness must stay between 0% and 100%. If a value is out of range the box turns red and explains what to fix instead of guessing. Transparency isn't part of this converter, so convert the opaque color and add opacity afterwards in CSS.
Common questions
Do I need the percent signs in the HSL value?
Yes, write saturation and lightness as percentages, for example hsl(282, 44%, 53%). The hue is a number of degrees from 0 to 360.
What does a saturation of 0% give me?
A grey. With no saturation the hue doesn't matter, and the lightness alone decides the shade, so hsl(0, 0%, 50%) is #808080.