InfyCalculator
💻

HEX to HSL Calculator

Convert a hex colour code to HSL (hue, saturation, lightness) and RGB — the CSS-ready values, with a plain-English reading of the colour.

Hex colour
Loading calculator…

How it works

normalise R,G,B to 0–1 · lightness L = (max+min)/2 · saturation S = (max−min)/(1−|2L−1|) · hue H from which channel is the max, ×60°

HEX and RGB describe a colour by how much red, green and blue light to mix; HSL describes the same colour the way people think about it — as a hue on the colour wheel, a saturation (grey to vivid) and a lightness (black to white). Converting starts by scaling the three channels to 0–1. Lightness is the midpoint of the brightest and darkest channel; saturation is their spread, scaled so it does not collapse near black or white; and hue comes from which channel dominates, measured in degrees around a 360° wheel. HSL is often easier to tweak in CSS: nudge the lightness for a hover state, or shift the hue for a colour scheme, without recomputing raw RGB.

Worked example

#3366ff is red 51, green 102, blue 255. Scaled to 0–1 that is 0.2, 0.4, 1.0, so lightness = (1.0 + 0.2) ÷ 2 = 0.6 = 60%. Blue is the maximum, which puts the hue at 225°, and the channel spread gives 100% saturation — so the colour is hsl(225, 100%, 60%), a vivid blue.

Sources: <hsl()> — MDN

Frequently asked questions

Why convert HEX to HSL?

HSL maps to how we adjust colour: change lightness for hover and active states, change saturation to mute or intensify, or rotate hue to generate a palette. Those edits are intuitive in HSL but awkward in raw hex, so designers often convert, tweak, and use the hsl() value directly in CSS.

Can I use hsl() directly in CSS?

Yes. Every modern browser supports hsl(), so you can paste the output — for example hsl(225, 100%, 60%) — straight into a stylesheet. It renders identically to the equivalent hex value.

What do the three numbers mean?

Hue is an angle from 0–360° on the colour wheel (0 red, 120 green, 240 blue). Saturation is 0–100%, from grey to fully vivid. Lightness is 0–100%, from black at 0% through the pure hue at 50% to white at 100%.

Related calculators

This calculator is for educational purposes. Double-check important results before acting on them.