ποΈ HSL to Hex Converter β Convert Colors Both Ways
Enter HSL or hex. Convert in either direction and see a live color swatch.
What this tool does
The HSL to Hex Converter translates between the hue-saturation-lightness model and hexadecimal color codes. A live preview helps you confirm the visual result of either direction of conversion.
HSL is convenient for adjusting lightness or saturation while keeping the same hue; hex is the format most CSS and design tools expect. The converter bridges the two without requiring an external color picker.
When to use it
- Turn a designerβs HSL value into a hex code for a stylesheet.
- Convert a brand hex color into HSL so you can create lighter and darker variants.
- Verify the HSL equivalent of a color sampled from a screenshot.
- Generate matching hex codes for a set of HSL-based theme tokens.
How it works
- Choose the conversion direction.
- Enter HSL values or a hex code.
- Click Convert to see the opposite format and a color preview.
Worked example
Set hue to 210, saturation to 70 and lightness to 50, then convert. The result is approximately #3B82F6. Switching to hex mode and entering #FF0000 produces hsl(0, 100%, 50%). Values outside the valid ranges are clamped so the conversion always succeeds.
- HSL 210, 70, 50 becomes approximately #3B82F6.
- Hex #FF0000 becomes hsl(0, 100%, 50%).
- Values are clamped to valid ranges.
Accuracy and limitations
- Alpha transparency is not supported. Eight-digit hex codes and hsla() values must be handled separately.
- Rounding of the intermediate RGB values can occasionally change the last hex digit by one.
- Named CSS colors and other notations such as rgb() must be converted to hex or HSL first.
- The preview is a simple swatch and does not account for surrounding color contrast.
Privacy and data handling
Color values are converted locally in your browser. No color data is uploaded or stored.
Frequently asked questions
Does it support alpha?
No. Only opaque colors are converted. Eight-digit hex and hsla() are not handled.
Why might the hex differ slightly?
Rounding of the intermediate RGB values can produce a one-digit difference in rare cases.
Why does the hex sometimes differ by one digit?
The conversion goes through 8-bit RGB values, so rounding can produce a one-unit difference in rare edge cases.
Related tools
More Design tools βColor Contrast Checker
Measure WCAG contrast between two hex colors for text and interface graphics.
Aspect Ratio Calculator
Solve width, height and simplified aspect ratios without breaking proportions.
CSS Gradient Generator
Generate CSS linear and radial gradients with live preview and copy-ready code.
Color Palette Generator
Generate five hex tints and shades from a single base color.