What is an HSL color?

HSL describes a color by its hue, saturation and lightness, close to how people talk about colors. The hue is an angle on the color wheel: 0 is red, 120 green and 240 blue. Saturation runs from 0% (gray) to 100% (full color), and lightness from 0% (black) through 50% (the pure color) to 100% (white). In CSS it's written as hsl(200, 50%, 50%), or in the newer form with spaces, hsl(200 50% 50%). A fourth value, the alpha, sets the opacity: hsla(200, 50%, 50%, 0.5) or hsl(200 50% 50% / 0.5).

Designers like HSL because each number changes one thing: raise the lightness for a paler shade, or turn the hue for a matching palette. You check an HSL color when a stylesheet ignores it, or when you build a theme editor or a form that accepts colors.

Tool description

Type or paste a color into the HSL color field, and the result shows as you type: "HSL color is valid" or "HSL color is not valid". Spaces and line breaks around the color are ignored. The page has no settings: it accepts both the form with commas and the form with spaces.

Forms that pass

  • Commas between the values, with or without spaces: hsl(200, 50%, 50%) or hsl(200,50%,50%)
  • Spaces between the values, with a slash before the alpha: hsl(200 50% 50%) or hsl(200 50% 50% / 0.5)
  • An alpha as a number or a percentage: hsla(200, 50%, 50%, 0.5) or hsla(200, 50%, 50%, 50%)
  • hsl() and hsla() alike, with or without an alpha: hsl(200, 50%, 50%, 0.5) and hsla(200, 50%, 50%) both pass
  • A hue with a unit, deg, turn, rad or grad: hsl(200deg, 50%, 50%) or hsl(0.5turn 50% 50%)
  • Decimals, negative numbers and capital letters: hsl(200.5, 50.5%, 50.5%), hsl(-30, 50%, 50%) or HSL(200, 50%, 50%)

Forms that fail

  • Saturation or lightness without a percent sign: hsl(200, 50, 50) or hsl(200 50 50)
  • Commas and spaces mixed in one color (hsl(200 50%, 50%)), or a slash in the form with commas (hsl(200, 50%, 50% / 0.5))
  • A slash without a space after it: hsl(200 50% 50%/0.5) fails, although hsl(200 50% 50% / 0.5) passes and CSS accepts both
  • The keyword none, as in hsl(none 50% 50%)
  • A space between hsl and the bracket

Good to know

  • The check looks at the form, not at the size of the numbers: hsl(400, 150%, 200%) passes, and so does an alpha of 2.
  • To use an HSL color where only RGB values work, convert it with the HSL to RGB Converter. To find a color by eye, use the Color Picker.

Features

  • Checks CSS hsl() and hsla() colors
  • The form with commas and the form with spaces, with or without an alpha
  • Hues in degrees, turns, radians or gradians
  • Results as you type, with no button to press
  • Runs in your browser, so nothing you type is sent anywhere