How to use HSL to Hex converter
- Type the color as hsl(249, 80%, 55%) or simply 249 80 55.
- Read the hex code and the color swatch, which update as you type.
- Copy the hex code, or copy RGB and CMYK from the list below.
Features
- Accepts hsl(), hsla() and three plain numbers
- Hue in degrees (any value wraps around 360), saturation and lightness from 0 to 100
- Gives a 6-digit hex code, or 8 digits when an alpha value is used
- Also lists RGB and CMYK with copy buttons
- Runs in your browser with no upload
Examples
| Input | Result |
|---|---|
| hsl(0, 100%, 50%) | #FF0000 |
| hsl(120, 100%, 50%) | #00FF00 |
| hsl(249, 80%, 55%) | #4C30E8 |
Limitations
- Hex codes hold whole-number channels, so the conversion rounds each channel: hsl(249, 80%, 55%) gives #4C30E8, which is close to but not the same as #4F33E8. Saturation and lightness must be between 0 and 100.
Learn more
Design tools and style guides often define colors in HSL because it is easy to reason about, while other tools, such as older CSS, image editors and brand guidelines, still ask for hex. This converter closes the gap for any value you type.
The math follows the standard: chroma is saturation times the range that lightness allows, hue picks which two channels carry that chroma, and the remaining channels take the lightness offset. Each channel is then scaled to 0 to 255 and written in base 16. Because three whole numbers cannot hit every possible hex color, round trips through HSL can change the last digit of a channel, so treat hex as the master value when exactness matters, and HSL as a convenient way to adjust it.
Frequently asked questions
How do I convert HSL to hex?
Convert HSL to red, green and blue values from 0 to 255, then write each one as two hexadecimal digits. The tool does both steps as you type.
What happens if the hue is above 360 or negative?
The hue wraps around the color wheel, so 370 is treated as 10 and -90 as 270.
Does it support transparency?
Yes. If you enter hsla(249, 80%, 55%, 0.5), the hex result has 8 digits, with the last pair holding the alpha.
Why is my result slightly different from my original hex?
Whole-number HSL loses precision. If you started from a hex code, keep it, rather than converting it through HSL and back.
Sources
Last reviewed: September 30, 2026