A hex to HSL converter is a small utility that turns a hex color code (`#3b82f6`) into the cylindrical Hue / Saturation / Lightness triple that encodes the same sRGB color (`hsl(217 91% 60%)`). Hex codes are the terse base-16 string designers and developers paste between Figma, Sketch, Photoshop, brand-guideline PDFs, and CSS stylesheets — three 8-bit channels packed into a 6-character `#RRGGBB` form, anchored to the sRGB color space defined by IEC 61966-2-1 in 1996. HSL is a cylindrical reshape of that same color space onto three more-designer-friendly axes: a hue angle on the color wheel, a chromatic saturation percent, and a lightness percent. Developers convert HEX → HSL constantly: to define a brand color as a CSS variable and then compose lighter or darker shades by adjusting only L, to feed a color-picker UI that displays Hue and SL as separate controls, to generate tint and shade ramps for a design system, or to perform runtime CSS variable math via `hsl(from var(--primary) h s calc(l + 10%))` for derived theme tokens. This tool runs the conversion live as you type, with no "Convert" button to click, and surfaces every other common color format (RGB, OKLCH, OKLAB, HSV, HWB, CMYK, plus the 148 CSS named colors) alongside the HSL output for free.
**The HSL format itself deserves a closer look.** HSL = Hue (0-360°), Saturation (0-100%), Lightness (0-100%). Hue is angular position on the color wheel — 0° is red, 60° is yellow, 120° is green, 180° is cyan, 240° is blue, 300° is magenta, and 360° wraps back to red. Saturation is chromatic intensity from 0% (achromatic gray) to 100% (fully chromatic with no gray content). Lightness is brightness from 0% (pure black, regardless of hue or saturation) through 50% (the pure hue at full chroma) to 100% (pure white, regardless of hue or saturation). Alvy Ray Smith published the original derivation in 1978 as part of the early computer-graphics push to give designers coordinate systems closer to their cognitive model of color than raw RGB channel addressing. The model has been in CSS since CSS3 (2010) and ships in every browser back to IE 9. The original CSS syntax used commas: `hsl(217, 91%, 60%)` for opaque, `hsla(217, 91%, 60%, 0.5)` for alpha-bearing. CSS Color 4 (W3C Candidate Recommendation since 2022) added a modern space-separated form: `hsl(217 91% 60%)` and `hsl(217 91% 60% / 0.5)` with slash-prefixed alpha — same syntax shape as the other CSS Color 4 functional notations (`rgb()`, `lab()`, `oklch()`, `color()`). Hue can also be expressed in turns (`hsl(0.6turn 91% 60%)`) or radians (`hsl(3.787rad 91% 60%)`), all equivalent to the canonical degree form. Every evergreen browser parses every syntactic flavor; the tool emits the modern space-separated form by default.
The conversion math goes both directions cleanly. **HEX → HSL** is a two-step pipeline. First, parse the 6-digit hex `#RRGGBB` as three 2-digit base-16 numbers via `parseInt(hex.slice(1, 3), 16)` etc. to get integer RGB channels in 0-255. Second, normalize each channel to 0-1 by dividing by 255, then compute `max = Math.max(r, g, b)`, `min = Math.min(r, g, b)`, `delta = max - min`. Lightness is the average of max and min: `L = (max + min) / 2`. Saturation is conditional on lightness: when L ≤ 0.5, `S = delta / (max + min)`; when L > 0.5, `S = delta / (2 - max - min)`. Equivalently in the CSS Color 4 §6.4 form, `S = delta / (1 - |2L - 1|)` (with S = 0 when delta = 0). Hue is piecewise on which channel is max: when R is max, `H = ((G - B) / delta) % 6`; when G is max, `H = (B - R) / delta + 2`; when B is max, `H = (R - G) / delta + 4`; multiply by 60 to scale to degrees, add 360 if negative. The inverse (HSL → HEX, via RGB) uses the helper `f(n) = L - a * max(-1, min(k-3, 9-k, 1))` where `a = S * min(L, 1-L)` and `k = (n + H/30) mod 12`, applied with n = 0, 8, 4 to produce R, G, B respectively, then scaled to 0-255 and hex-encoded.
**Why HSL is still useful.** Intuitive sliders — adjusting L predictably brightens or darkens without breaking hue identity, while adjusting an RGB channel produces a less predictable color shift. Runtime CSS math — modern browsers support `hsl(from var(--primary) h s calc(l + 10%))` to derive theme tokens at render time. Designer cognition — designers raised on HSV color pickers reason about color in hue + chroma terms even when the file ships hex. **HSL's problem** is that its Lightness axis is not perceptually uniform — a green at L=50% looks visibly brighter than a blue at L=50% because HSL inherits sRGB's gamma quirks and treats every hue as equivalent on the L scale. When you need perceptual uniformity (palette generation where every step should look equally bright, dark-mode token computation that doesn't accidentally make blue text harder to read than green text), reach for OKLCH instead — the same tool surfaces both, so the choice is one glance away.
This tool's HEX → HSL workflow is one direction of a 5-spoke family that all share the same underlying unified color converter. The dedicated unified color converter is the hub — it shows all 9 formats simultaneously editable and is the right tool when your workflow needs more than just hex and HSL. The single-direction spokes target specific Google search intents: the hex to RGB converter for the canvas-and-hardware direction, the RGB to hex converter for the inverse, the hex to OKLCH converter for modern perceptually-uniform design systems (Tailwind v4 and shadcn both default to OKLCH now), and the hex to CMYK converter for print-prep approximations. All five spokes and the hub share the same parsing engine and the same conversion math, so the results are guaranteed identical across the family. Every conversion runs locally in your browser — your hex codes are never uploaded, never logged, and zero network requests fire as you type. Verify in DevTools.