HomeToolsConversionColor HSL Converter

Color HSL Converter

Convert Hex/RGB color values to HSL (Hue, Saturation, Lightness) format and back.

Conversion
HSL Conversion
hsl(217, 91%, 60%)

HSL as a Way to Describe Color

HSL separates a color into hue, saturation, and lightness. Hue places it around a 360-degree color wheel, saturation describes distance from gray, and lightness runs from black through the color to white. That vocabulary is often easier for design adjustments than changing red, green, and blue channels independently.

This color HSL converter takes a hexadecimal color and produces a CSS hsl() value. Enter a three- or six-digit hex code in Hex Color Input. The preview swatch and HSL Conversion panel update when the input is valid, and Copy places the complete HSL function on the clipboard. The initial #3b82f6 becomes hsl(217, 91%, 60%).

The conversion direction in this implementation is specifically Hex to HSL. Despite the broad page name, there are no H, S, and L input sliders and it does not convert HSL back to hex or RGB. Use the output as a starting point in CSS, a design token, or a color-analysis workflow.

A Practical Reading of the Three Numbers

Consider hsl(217, 91%, 60%).

Hue 217° lies in the blue region. Moving hue while holding the other values steady changes the basic color family. Hue wraps around: 0° and 360° both correspond to red. Common landmarks are approximately 60° yellow, 120° green, 180° cyan, 240° blue, and 300° magenta.

Saturation 91% indicates a vivid color with little gray mixed into its chromatic character. At 0% saturation, hue has no visible effect because the result is neutral gray. Saturation does not mean opacity and does not directly measure display gamut.

Lightness 60% places the color above the midpoint toward white. HSL lightness at 0% is black and at 100% is white, regardless of hue or saturation. A 50% lightness value is not guaranteed to have equal perceived brightness across hues; saturated yellow appears much brighter than saturated blue at the same HSL lightness.

Use the Converter in a Token Workflow

Start with a known brand or interface hex value, such as #0f766e. Paste it with or without the leading #. The converter strips the hash and evaluates the remaining digits. Once the preview matches the expected teal, copy the HSL expression into a scratch stylesheet:

.status-success {
  background-color: hsl(175, 77%, 26%);
}

HSL becomes particularly useful when a component needs related states. After obtaining the baseline, you can test a lighter hover surface by increasing lightness or make a muted border by reducing saturation. Those derivative edits happen outside this converter, since the page provides only hex input, but the output gives readable parameters to modify.

For CSS custom properties, either store the complete function or store channels according to your project’s convention:

:root {
  --brand-color: hsl(217, 91%, 60%);
}

Copying the full function is safest because the tool includes commas and percent signs in standard legacy CSS color syntax. If a framework expects space-separated channels or raw variables such as 217 91% 60%, adapt the copied string to that format.

What Inputs Are Actually Accepted

Three-digit shorthand expands by repeating each digit. Thus #0af means #00aaff, not #000aff. Six-digit values map two hexadecimal digits to each RGB channel. Uppercase and lowercase hex digits are equivalent, and the leading hash is optional because it is removed before parsing.

The converter does not support four-digit #RGBA or eight-digit #RRGGBBAA input. Alpha is not represented in its output. It also does not parse named CSS colors, rgb() strings, hsl() strings, or modern color spaces such as OKLCH, Lab, or Display P3.

Whitespace around the entire input is trimmed. A hash elsewhere in the string is removed by the simple cleaning step, but relying on malformed forms is unwise; use canonical #rgb or #rrggbb. Only a cleaned length of three or six triggers conversion.

Invalid Input Has a Subtle Failure Mode

The output has no visible validation message. If the cleaned input is not six characters after shorthand expansion, the previous valid HSL output remains in the result panel. Some six-character strings containing non-hex characters can produce invalid numeric channels and an hsl(NaN, NaN%, NaN%)-style result rather than a friendly error.

This makes the preview an important check. Never assume the displayed output was generated from the current field if the input is incomplete, for example while typing #ff toward #ff0000. Finish the valid code, compare the swatch, and only then press Copy.

The calculator rounds hue to a whole degree and saturation and lightness to whole percentages. Round-trip conversion through another tool may therefore return a nearby but not byte-identical hex color. The displayed swatch is based on the rounded HSL output, so subtle channel differences can occur for colors near rounding boundaries.

HSL Is Convenient, Not Perceptually Uniform

HSL is an encoding derived from sRGB geometry, not a model of human vision. Equal 10-point lightness changes do not look equally strong for every hue. A generated series of HSL lightness values can have uneven perceived steps, and contrast cannot be judged from lightness alone.

For accessible text and background combinations, test the final rendered colors with a WCAG contrast checker. Do not infer that L: 60% is safe behind white text or that two colors separated by 50 lightness points meet a particular ratio. Browser rendering, font weight, and the actual sRGB luminance all matter.

When building large color scales, perceptual spaces such as OKLCH may produce more regular visual progression. HSL remains valuable for quick inspection, CSS compatibility, and intuitive manual adjustments, but it is not the right instrument for color-difference measurement or gamut mapping.

Diagnostic Examples

  • #ffffff converts to white with saturation 0% and lightness 100%. Hue is reported as 0 by convention, though hue is visually undefined for white.
  • #000000 similarly has 0% saturation and 0% lightness.
  • #808080 is a neutral gray around 50% lightness. Changing its reported hue alone has no effect until saturation rises.
  • #ff0000 is red at approximately hsl(0, 100%, 50%).
  • #00ff00 is CSS’s full-intensity green at approximately hsl(120, 100%, 50%), which appears much brighter than full blue despite equal HSL lightness.

These anchors are useful for noticing a mistyped channel. If pure red does not land near hue zero, inspect the source value before trusting downstream calculations.

Mistakes to Avoid

Do not include an alpha pair and expect it to be preserved. Do not paste a bare three-digit number from a spreadsheet if leading zeros may have been removed. Do not call saturation “color brightness”; it measures chroma-like intensity within HSL, while lightness controls the black-to-white axis. Do not use HSL lightness as an accessibility score. Finally, do not copy while the input field is midway through an edit, because the panel can retain the last valid conversion.

Color HSL Converter FAQ

Can I convert HSL to hex with this page?

No. The active control accepts hex and the output is HSL. There is no reverse-conversion input in this component.

Does it support hex alpha colors?

No. Only three- and six-digit RGB hex forms are converted. Four- and eight-digit forms are not processed, and output uses hsl() rather than hsla().

Why did the result not change while I typed?

Conversion runs only when the cleaned value has a supported length. During an incomplete or malformed entry, the previous output may remain visible.

Why does another converter give a slightly different value?

This tool rounds all three HSL channels to integers. Another implementation may retain decimals or use different rounding, yielding slightly different text for effectively the same color.

Is hue meaningful for black, white, or gray?

Not visually. At 0% saturation, all hue angles render the same neutral shade. The converter reports hue 0 as a practical default.

Does the conversion leave the browser?

The arithmetic occurs in the React component in the browser. Clipboard access happens only when Copy is pressed and is subject to browser clipboard permissions.

Can I use the copied value directly in CSS?

Yes. The result is a complete conventional CSS color function such as hsl(217, 91%, 60%). Check whether your linting or token system requires a newer space-separated syntax before committing it.

Learn More

Read our comprehensive guide to master this utility.

Read Guide →