FormatterHQ

HEX to HSL Converter

Rewrite hex color codes as hue, saturation and lightness so you can create lighter, darker or muted variations by changing a single number.

Loading tool…
Ready.

How to use the HEX to HSL Converter

  1. Type or paste a hex color such as #0F766E or #abc into the HEX field, or choose one with Pick colour.
  2. The HSL field updates as you type and shows hsl(h, s%, l%), or hsla() when the hex code includes alpha.
  3. Copy the value with the button next to the field, then adjust the lightness or saturation to derive related colors.

Convert HEX to HSL for easier color tweaks

A HEX to HSL converter rewrites a hex code as hue, saturation and lightness, the CSS color model that is easiest to adjust by hand. Where #0F766E tells you almost nothing at a glance, hsl(175, 77.4%, 26.1%) reads as "a fairly saturated, dark blue-green".

What the three HSL numbers mean

  • Hue is an angle on the color wheel: 0° red, 120° green, 240° blue, returning to red at 360°.
  • Saturation is the distance from grey, from 0% to 100%.
  • Lightness runs from 0% (always black) to 100% (always white); 50% is the most vivid version of the hue.

The conversion, step by step

The hex code is first decoded to RGB and each channel divided by 255. With max and min as the largest and smallest of those fractions and d = max − min:

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

Applied to #0F766E:

#0F766E → rgb(15, 118, 110)
R = 0.0588   G = 0.4627   B = 0.4314
max = 0.4627 (G)   min = 0.0588   d = 0.4039
L = (0.4627 + 0.0588) / 2        = 0.2608 → 26.1%
S = 0.4039 / (1 − |0.5216 − 1|)  = 0.7744 → 77.4%
H = 60 × ((0.4314 − 0.0588) / 0.4039 + 2) = 175.3 → 175
→ hsl(175, 77.4%, 26.1%)

Hue is rounded to a whole degree, saturation and lightness to one decimal place. Greys have no hue (d is 0), so white, black and every grey come out as hsl(0, 0%, L).

Why designers convert to HSL

Once a brand color is in HSL, a family of related colors is a matter of changing one number. Keep hue and saturation and move lightness: hsl(175, 77.4%, 90%) is a pale background tint and hsl(175, 77.4%, 18%) a darker pressed state. Adding 180° to the hue gives the complementary color.

That is why HSL is popular in CSS custom properties and theme systems, where storing hue, saturation and lightness separately lets you derive light and dark variants from a few variables. For a ready-made ladder of tints and shades, try the HEX colortone generator.

Transparency and precision

If the hex code has an alpha byte, such as #0F766E80, the result keeps it: hsla(175, 77.4%, 26.1%, 0.502). Because the HSL numbers are rounded, converting back usually returns the same hex code but can occasionally land one step away in a channel. Keep the original hex as your source of truth and use HSL for deriving variations; the HSL to HEX converter handles the return trip.

HSL lightness is not perceived brightness

Equal lightness values don't look equally bright across hues. hsl(60, 100%, 50%) (yellow) appears far lighter than hsl(240, 100%, 50%) (blue), although both have 50% lightness. Check text contrast with a proper contrast measurement rather than trusting the L value. And if you are typing values into a design app's color picker, you probably want HEX to HSV instead.

Frequently asked questions

Is HSL the same as HSV or HSB?
No. They share the same hue, but saturation is defined differently and HSL lightness is unrelated to HSV value. For example, #FACC15 is hsl(48, 95.8%, 53.1%) but hsv(48, 91.6%, 98%).
Can I use hsl() directly in CSS?
Yes. hsl() is supported by all browsers. Modern CSS also accepts the space-separated form hsl(175 77.4% 26.1%) and an optional alpha after a slash.
Why is the hue 0 for white, black and grey?
When red, green and blue are equal there is no dominant color, so hue is undefined. By convention it is written as 0 with 0% saturation; only the lightness matters.
Why do other tools show slightly different HSL numbers?
Tools round differently. Some round saturation and lightness to whole percentages, while this one keeps one decimal place. Differences of a fraction of a percent describe the same color.

Last updated October 3, 2026

Related tools

HSL to HEX Converter Convert HSL colour values to HEX instantly, with a live colour swatch preview, colour picker and copy buttons. CMYK to HSL Converter Convert CMYK colour values to HSL instantly, with a live colour swatch preview, colour picker and copy buttons. HSL to CMYK Converter Convert HSL colour values to CMYK instantly, with a live colour swatch preview, colour picker and copy buttons. HSL to HSV Converter Convert HSL colour values to HSV instantly, with a live colour swatch preview, colour picker and copy buttons. HSL to RGB Converter Convert HSL colour values to RGB instantly, with a live colour swatch preview, colour picker and copy buttons. HSL to RGBA Converter Convert HSL colour values to RGBA instantly, with a live colour swatch preview, colour picker and copy buttons. HEX to HSV Converter Convert HEX colour values to HSV instantly, with a live colour swatch preview, colour picker and copy buttons. HEX to RGB Converter Convert HEX colour values to RGB instantly, with a live colour swatch preview, colour picker and copy buttons. HEX to RGBA Converter Convert HEX colour values to RGBA instantly, with a live colour swatch preview, colour picker and copy buttons. HSV to CMYK Converter Convert HSV colour values to CMYK instantly, with a live colour swatch preview, colour picker and copy buttons. HSV to Colortone Converter Generate the tints, shades and tones of a HSV colour as a palette with swatches and ready-to-copy codes. HSV to HEX Converter Convert HSV colour values to HEX instantly, with a live colour swatch preview, colour picker and copy buttons.