Skip to content

Convert a colour

Convert a colour between HEX, RGB and HSL in one step.

colourhexrgbhsl

Upload

Colour Any accepted form: #rgb, #rrggbb, #rrggbbaa (with or without #), rgb(), rgba(), hsl(), hsla() and the bare comma or space shapes. Alpha as 0 to 1 or a percentage.
Questions people ask
Which forms does the tool accept?
HEX with or without the # in the 3, 4, 6 and 8 digit forms, rgb() and rgba() with whole channels 0 to 255 or percents, hsl() and hsla() with a hue angle and percent saturation and lightness, and the same shapes bare without a function word. Separators may be commas or spaces, and an optional slash carries the alpha.
How is alpha handled?
A 0 to 1 decimal or a percentage is accepted (50% reads as 0.5). It is reported to 3 decimals in the rgba() and hsla() forms. The hex form stays 6 digits and opaque: the alpha is carried on its own field, not folded into the hex.
Are the numbers rounded, and how?
Yes, by the stated rules: percent channels round half up to whole numbers, hue, saturation and lightness carry 1 decimal, and alpha 3. A value such as rgb(100%, 0%, 50%) is therefore reported as rgb(255, 0, 128), not 127.5.
What does the from_format option do?
Auto detects the notation from the value's syntax, which suits copy and pasting. An explicit choice validates strictly, and a value that contradicts the chosen notation is refused with a mismatch message instead of being guessed.
Do out-of-range values get clamped?
No. rgb(300, 0, 0) or hsl(370, 200%, 40%) are refused with a named error and the accepted grammar, so a typo can never turn into a quietly different colour. Hue angles are the one exception: they wrap, so 370 degrees reads as 10, as CSS behaves.
Is anything uploaded?
No. This tool takes a typed value only; there is no upload surface, nothing leaves your browser, and the report is a small JSON file that lives for about 10 minutes.