← Zaps Colors
Converter

HEX to HSL Converter

Paste a HEX code to get its hsl() value for CSS. Use the sliders to adjust hue, saturation and lightness.

3 or 6 digits, with or without #

Adjust the color
29
100%
59%
HSLhsl(29, 100%, 59%)
HSLhsl(29 100% 59%)
HEX#FF922E
RGBrgb(255, 146, 46)

What this HEX to HSL converter does

It converts a HEX color code into the hsl() format used in CSS. Paste a code such as #ff922e, ff922e or f92 and the HSL value appears straight away, along with the matching RGB. The sliders let you shift hue, saturation and lightness and read off the new HEX code, which makes it a quick way to build a lighter, darker or more muted version of a brand color.

How to convert HEX to HSL

  1. Paste a HEX code into the HEX field.
  2. Read the HSL row, in comma or space syntax.
  3. Move H, S or L to adjust the color. The HEX code updates to match.
  4. Click Copy on the row you want, or Copy link to share the color.

The HEX to HSL formula

First convert the HEX pairs to R, G and B, then scale each to 0 to 1 by dividing by 255. With max and min as the largest and smallest of the three and d = max - min:

L = (max + min) / 2
S = 0                            if d = 0
S = d / (1 - |2L - 1|)           otherwise
H = 60 × (((G - B) / d) mod 6)   if R is the max
H = 60 × ((B - R) / d + 2)       if G is the max
H = 60 × ((R - G) / d + 4)       if B is the max

For #FF922E the channels are 255, 146 and 46, so the scaled values are 1.000, 0.573 and 0.180. That gives d = 0.820, L = 0.590 (59%), S = 1.000 (100%) and H = 60 × 0.478 = 28.7, which rounds to 29. The result is hsl(29, 100%, 59%).

Common colors in HEX and HSL

ColorHEXHSL
Red#FF0000hsl(0, 100%, 50%)
Orange#FFA500hsl(39, 100%, 50%)
Yellow#FFFF00hsl(60, 100%, 50%)
Green#008000hsl(120, 100%, 25%)
Blue#0000FFhsl(240, 100%, 50%)
Purple#800080hsl(300, 100%, 25%)

Hue 0 is red, 60 yellow, 120 green, 180 cyan, 240 blue and 300 magenta. For lighter and darker variations of one color, move only L. To turn a color into a gray, bring S to 0.

Related color tools

HEX to HSL FAQ

How do I convert HEX to HSL?

Convert the HEX pairs to R, G and B, then divide each by 255. Lightness is the average of the largest and smallest values. Saturation compares their gap to how far lightness sits from the middle. Hue is the angle on the color wheel set by whichever channel is largest. #FF922E becomes hsl(29, 100%, 59%).

What do H, S and L stand for?

H is hue, an angle from 0 to 360 degrees around the color wheel, where 0 is red, 120 is green and 240 is blue. S is saturation, from 0% (gray) to 100% (full color). L is lightness, from 0% (black) through 50% (the pure color) to 100% (white).

Why use HSL instead of HEX in CSS?

HSL is easier to adjust by hand. To make a hover color slightly darker, lower L by 8 or 10 points and leave H and S alone. Doing the same with a HEX code means working out new values for all three channels.

Is the HSL value an exact match for the HEX code?

It is rounded to whole numbers, which is how HSL is normally written. Converting back can land one step away in a channel, so the HEX code you get back may differ by 1 in a digit pair. Keep the original HEX when an exact match matters.

Which hsl() syntax should I use?

Both hsl(29, 100%, 59%) and hsl(29 100% 59%) work in current browsers. The first is the older comma form and the second is the modern form, which also takes alpha as hsl(29 100% 59% / 50%). The tool shows both so you can copy either one.

Does it handle 8-digit HEX codes with alpha?

This page reads 3 and 6 digit codes. If you have an 8-digit code, drop the last two digits to convert the color, then add the opacity yourself in CSS, for example hsl(29 100% 59% / 50%).

Put these colors to work

Pick a Zaps template for your next post, story or reel, add your photos and match it to your palette.