Skip to content

HSL to Hex

Turn hue, saturation and lightness into a hex code.

How to use the hSL to hex

Three steps, all in your browser.

  1. 1

    Enter a color

    Type or paste a code in any format, or use the picker.

  2. 2

    See every format

    The converted values update as you type, in every format at once.

  3. 3

    Copy the codes

    Copy any color code in one click, or share the page link.

HSL to Hex: what to know

HSL to Hex converts hue, saturation and lightness into a hex color code. Enter the three values, or paste an hsl() value from your CSS, and copy the matching hex code for design tools, brand guides or anything that doesn't speak HSL.

The conversion first finds the color's chroma (how far it is from gray) from saturation and lightness, places it on the hue wheel to get red, green and blue, then rounds each to a whole number from 0 to 255 and writes it in base 16. Because of that rounding, very close HSL values can map to the same hex code.

It's a handy companion to hand-tuning colors in HSL: adjust in HSL, where changes are intuitive, then hand off the hex code, which every tool understands.

Popular uses

  • Exporting colors tuned in CSS HSL to a design tool
  • Turning HSL values from a tutorial into hex
  • Documenting a theme's colors in a style guide
  • Checking which hex code an HSL value produces

Tips for the best result

  • Lightness 0% is always black and 100% always white, whatever the hue.
  • Hue 360 is the same as 0 (red); values are wrapped around the wheel.
  • If two HSL values give the same hex code, they're closer than one hex step apart.

Read how JustYourPalette works, browse named colors and curated palettes, and see our privacy details. Colors you enter and images you open are processed in your browser and are never sent to our server.

Frequently asked questions

Almost. Hex has 256 steps per channel, so HSL values are rounded to the nearest representable color. Converting back can shift a value by a fraction of a percent or a degree.

HSL lightness is not perceptual: pure yellow is far brighter to the eye than pure blue at the same HSL lightness. Use OKLCH when you need colors that look equally light.

No. Every tool runs in your browser, so the colors you enter and any image you open are processed on your device and are not sent to our server or stored. Reloading or closing the page clears them.

Yes. Every tool is free with no sign-up and no limits on use. Clearly labeled ads keep it that way.

Yes. Colors and color codes aren't owned by anyone, so you can use anything you make here in personal and commercial projects. Brand colors may still be protected as part of a trademark.