HEX to HSL converter

Royal blue #4169E1 is hsl(225, 73%, 57%): hue 225° on the color wheel, 73% saturation, 57% lightness.

#4169E1
RGBrgb(65, 105, 225)
HSLhsl(225, 73%, 57%)
HSVhsv(225, 71%, 88%)
HWBhwb(225 25% 12%)
CMYKcmyk(71, 53, 0, 12)
OKLCHoklch(0.56 0.19 266)
OKLABoklab(0.560 -0.012 -0.188)
LABlab(46.8 17.8 -66.7)
LCHlch(46.8 69.0 285)
DECIMAL4286945
≈Royal blue

Free·No sign-up·Works offline after the first visit

  • 1. HEX to RGB, then divide by 255: R = 0.255, G = 0.412, B = 0.882.
  • 2. Lightness L = (max + min) ÷ 2 = (0.882 + 0.255) ÷ 2 = 0.569 → 57%.
  • 3. Saturation S = (max − min) ÷ (1 − |2L − 1|) = 0.627 ÷ 0.863 = 0.727 → 73%.
  • 4. Hue: blue is the largest, so H = 60 × ((R − G) ÷ (max − min) + 4) = 60 × 3.75 = 225°.

Common colors in HEX and HSL

colorHEXHSL
White#FFFFFFhsl(0, 0%, 100%)
Black#000000hsl(0, 0%, 0%)
Red#FF0000hsl(0, 100%, 50%)
Lime#00FF00hsl(120, 100%, 50%)
Blue#0000FFhsl(240, 100%, 50%)
Yellow#FFFF00hsl(60, 100%, 50%)
Cyan#00FFFFhsl(180, 100%, 50%)
Magenta#FF00FFhsl(300, 100%, 50%)
Gray#808080hsl(0, 0%, 50%)
Orange#FFA500hsl(39, 100%, 50%)
Purple#800080hsl(300, 100%, 25%)
Gold#FFD700hsl(51, 100%, 50%)
HEXRGB
White#FFFFFFrgb(255, 255, 255)
Black#000000rgb(0, 0, 0)
Red#FF0000rgb(255, 0, 0)
Green#008000rgb(0, 128, 0)
Blue#0000FFrgb(0, 0, 255)
Yellow#FFFF00rgb(255, 255, 0)
Orange#FFA500rgb(255, 165, 0)
Purple#800080rgb(128, 0, 128)
Pink#FFC0CBrgb(255, 192, 203)
Gray#808080rgb(128, 128, 128)
Gold#FFD700rgb(255, 215, 0)
Navy blue#000080rgb(0, 0, 128)

How to convert HEX to HSL by hand

HSL describes a color by hue, saturation and lightness, which is close to how people talk about color. The hue is an angle on the color wheel: 0° is red, 120° green, 240° blue. Saturation says how strong the color is, from gray (0%) to full color (100%). Lightness runs from black (0%) through the pure color (50%) to white (100%).

To convert, turn the HEX code into RGB values between 0 and 1, find the largest and smallest, and follow the four steps above. When all three channels are equal, the color is a gray: saturation is 0 and the hue doesn't matter. Designers like HSL for building shades: keep the hue and saturation of a brand color, change only the lightness, and you get a lighter or darker version that still belongs to it. In CSS you can write it directly: hsl(225 73% 57%).

Questions and answers

How do I convert HEX to HSL?

Convert to RGB (0-1), then L = (max + min) ÷ 2, S = (max − min) ÷ (1 − |2L − 1|), and the hue from whichever channel is largest.

What is the HSL of white?

hsl(0, 0%, 100%). Black is hsl(0, 0%, 0%).

Is HSL the same as HSV or HSB?

No. They share the hue, but HSV measures brightness differently: in HSV, 100% is the brightest color, not white.