HSL to Hex Converter

To convert HSL to hex, take the hue (0–360°), saturation (0–100%), and lightness (0–100%), work out the red, green, and blue amounts, and write each as two hex digits. For example, hsl(217, 91%, 60%) is #3B82F6.

Convert HSL values to a hex color code instantly. Enter hue, saturation, and lightness and get the hex code with one click to copy.

#3B82F6
Preview:

How HSL to hex conversion works

HSL is converted back to RGB first: lightness sets how bright the color is, saturation sets how much of the hue shows through, and hue picks the position on the color wheel. The resulting red, green, and blue values (0–255 each) are then written as two hex digits each. For example, hsl(217, 91%, 60%) gives rgb(59, 130, 246), which is #3B82F6.

This is handy when you design in HSL — for example, picking a base hue and then making a whole scale by changing only the lightness — but your code needs hex values.

Frequently asked questions

What is the hex of hsl(0, 100%, 50%)?

hsl(0, 100%, 50%) is #FF0000, pure red.

What happens if saturation is 0%?

With 0% saturation the color is gray: hsl(any hue, 0%, 50%) is #808080.

What happens if lightness is 0% or 100%?

Lightness 0% is always black (#000000) and 100% is always white (#FFFFFF), whatever the hue and saturation.

Related tools

Color Converter (all formats) · Hex to RGB · RGB to Hex · Hex to HSL · HSL to Hex · Color Picker