100% on-device · nothing uploaded
Colour converter — HEX, RGB, HSL
Type a colour as hex, rgb() or hsl() — or pick one — and get all three notations instantly, with a live swatch. Alpha is handled, so a translucent colour round-trips to 8-digit hex and rgba/hsla. Nothing is uploaded.
How to use it
- Type a colour in any notation — #7c3aed, rgb(124 58 237), hsl(262 83% 58%) — or use the colour picker.
- HEX, RGB and HSL update together; the swatch shows the exact colour, checkerboard behind it for transparency.
- Tap Copy on the format you need.
What HSL is good at, and where it misleads
HEX and RGB are the same thing in different bases: #7c3aed is rgb(124 58 237), nothing more. HSL is a genuine reprojection: the RGB cube tipped onto its grey diagonal and read off as an angle, a saturation and a lightness. That is what makes it the notation to reason in when building a palette — rotate the hue 30 degrees for a neighbouring colour of the same intensity.
The catch is that HSL’s lightness is not perceived lightness. hsl(60 100% 50%) is pure yellow and hsl(240 100% 50%) pure blue; both declare 50% lightness, and the yellow is many times brighter to the eye. Selecting text colours by matching L values therefore produces pairs that fail WCAG contrast, since contrast is computed from relative luminance, which weights green far above blue. OKLCH and LCH exist to correct exactly this.
Where a round trip loses something
HEX to RGB and back is lossless: each pair of hex digits is one byte, and a three-digit shorthand doubles each digit, so #7ce is precisely #77ccee. HSL is different. It is computed in floating point and written out in whole degrees and percentages — the conventional readable form, and also a quantisation. A round trip can shift a channel by one, about 0.4% of its range, which no display resolves.
Grey is where HSL turns ambiguous: with saturation at zero the hue is undefined, so every hue value round-trips identically and a converter reporting 0 degrees is choosing rather than measuring. The larger boundary is that all three notations are sRGB, which cannot express what a P3 display shows. There is no hex for a saturated cyan outside the sRGB triangle; CSS reaches those through color(display-p3 ...) or oklch().
Questions
Which formats are supported?
Input: 3-, 4-, 6- and 8-digit hex, rgb()/rgba() and hsl()/hsla(), with commas or spaces. Output: HEX (8-digit when there is alpha), RGB/RGBA and HSL/HSLA.
Does it keep transparency?
Yes. An alpha below 1 is preserved across all three: it becomes the last pair of an 8-digit hex and the fourth value of rgba()/hsla().
Are the conversions exact?
HEX and RGB are exact. HSL is rounded to whole degrees and percents — the standard, human-readable form — so a round-trip can shift by one unit, which is imperceptible.
Is anything sent to a server?
No. It is pure arithmetic in your browser; no colour you enter leaves the page.
Updated 2026-07-20. Runs fully in your browser — nothing is uploaded.