Guide

HSL Colors Explained

HSL describes a color the way people think about it: which color (hue), how vivid it is (saturation) and how light or dark it is (lightness). Royal blue is hsl(225, 73%, 57%).

The three parts of HSL

Hue is the position on the color wheel, measured in degrees from 0 to 360. Saturation is the intensity of the color, from 0% (gray) to 100% (fully vivid). Lightness runs from 0% (black) through the pure color at 50% to 100% (white).

Hue angles and the colors they give at 100% saturation and 50% lightness
HueColorValueHEX
0° Redhsl(0, 100%, 50%)#FF0000
30° Orangehsl(30, 100%, 50%)#FF8000
60° Yellowhsl(60, 100%, 50%)#FFFF00
120° Greenhsl(120, 100%, 50%)#00FF00
180° Cyanhsl(180, 100%, 50%)#00FFFF
240° Bluehsl(240, 100%, 50%)#0000FF
300° Magentahsl(300, 100%, 50%)#FF00FF

The wheel is a circle, so 360° is the same as 0°: you arrive back at red. Royal blue, hsl(225, 73%, 57%), has a hue of 225°, which is between cyan (180°) and blue (240°), closer to blue. Its saturation is fairly high at 73% and its lightness is a little above the middle at 57%.

Building a scale from one color

This is why designers like HSL: to make a lighter or darker version of a color you change one number and leave the other two alone. Here is royal blue at seven lightness levels, with the contrast ratio of white text on each one:

Royal blue at different HSL lightness values and white text contrast
LightnessColorHEXWhite text contrast
95% hsl(225, 73%, 95%)#E9EEFC1.16:1
85% hsl(225, 73%, 85%)#BDCBF51.61:1
70% hsl(225, 73%, 70%)#7B97EA2.81:1
57% (base) hsl(225, 73%, 57%)#4169E14.84:1
47% hsl(225, 73%, 47%)#204CCF7.00:1
37% hsl(225, 73%, 37%)#193CA39.47:1
25% hsl(225, 73%, 25%)#11286E13.52:1

A common pattern is to use the base color for a button, the 47% step for its hover state and the 37% step for its pressed state. The pale 95% step makes a good background for notices. The tints and shades generator builds scales like this for any color.

Matching colors by changing the hue

Because hue is a single number, finding related colors is simple arithmetic. Add 180° to get the complement: royal blue at 225° becomes 45°, which is hsl(45, 73%, 57%) or #E1B941, a warm gold. Add or subtract 30° for neighboring (analogous) colors, or add 120° and 240° for a triad. The color theory guide shows all of these with examples, and the palette generator does the math for you.

HSL in CSS

color: hsl(225, 73%, 57%);
color: hsl(225 73% 57%);
color: hsl(225deg 73% 57% / 50%);

The comma-free syntax and the slash for opacity are the modern forms. The older hsla() function still works. Rounded HSL numbers can differ from the exact color by a very small amount, so a color converted to HSL and back may land one step away in a HEX digit.

What HSL does not tell you

HSL lightness is a mathematical value, not how bright a color looks. Yellow hsl(60, 100%, 50%) and blue hsl(240, 100%, 50%) both have 50% lightness, yet yellow has a contrast ratio of only 1.07:1 with white while blue has 8.59:1. Two colors with equal HSL lightness can have very different readability, so never rely on lightness alone to make text legible. Check the actual contrast ratio with the contrast checker.

HSL vs HSB and HSV

Many design apps use HSB (also written HSV), where the third value is brightness. They look similar but are not the same: in HSB, 100% brightness is the brightest version of the hue, not white. In HSL, 100% lightness is always white. If a value from a design app does not match the HSL value on this site, check which of the two the app is showing. The color converter lists both.

Try it yourself

Turn RGB values into hue, saturation and lightness.

Open the RGB to HSL Converter