Convert between HEX, RGB and HSL.
Convert a color between HEX, RGB and HSL by typing in any one of the three fields; the other two update at once. Each format has a copy button and a color picker and live swatch show the result. It is for developers and designers who receive colors in one format and need another.
HEX, RGB and HSL are three ways to write the same sRGB color in CSS. HEX is a hash followed by two hexadecimal digits each for red, green and blue, such as #6366f1; a fourth pair adds alpha. RGB writes the same channels as decimals from 0 to 255, such as rgb(99, 102, 241). HSL describes a color by hue in degrees from 0 to 360, saturation as a percentage and lightness as a percentage, which is easier to reason about when you want a lighter or less saturated variant. Converting between them is mathematical, though HSL values are usually rounded to whole numbers, so converting back can differ by a small amount.
HEX with 3, 4, 6 or 8 digits (hash optional), rgb() and rgba(), and hsl() and hsla(). Values may be separated by commas, spaces or a slash. Named colors like red are not supported.
HSL values are rounded to whole degrees and percents, which loses a little precision. Converting that rounded HSL back can land one or two steps away in a channel.
An 8-digit HEX or a fourth number in rgba() or hsla() is treated as alpha. The outputs use rgba() and hsla() when alpha is below 1, and the HEX output gets an alpha pair.
Yes. The parser reads the numbers in order as hue, saturation and lightness, so percent signs are optional. Output is always written with percent signs.
No. Only HEX, RGB and HSL are supported.