Color Converter
Convert a color between HEX, RGB, HSL, OKLCH and CMYK.
Results are provided as is, for general information. Check anything important before relying on it. See the Terms of Use.
About Color Converter
Enter a color in any common CSS form — #rgb / #rrggbb / #rrggbbaa hex, rgb() / rgba(), hsl() / hsla(), oklch(), cmyk(), or one of the 148 CSS named colors plus transparent — and get every other representation back with a live swatch. The sRGB, HSL and hex conversions are exact; OKLCH is computed from Björn Ottosson's OKLab matrices in the page; CMYK is the simple screen conversion without a print profile. Comma and space function syntax both work, values may be numbers or percentages, and input is case-insensitive.
When to use Color Converter
Color Converter FAQ
Why use OKLCH instead of HSL?
OKLCH is perceptually uniform: equal numeric steps in lightness or chroma look like equal visual steps, and changing the hue does not shift the apparent brightness. That makes it far more predictable than HSL for generating color scales, adjusting contrast, or interpolating between colors programmatically.
What happens to an OKLCH color that is not displayable in sRGB?
OKLCH can describe colors outside the sRGB gamut. When you enter one, each channel is clamped into range before conversion, so the RGB and hex values are the nearest in-gamut approximation rather than an exact match. The tool shows a notice when this happens.
Are the conversions lossy?
Hex, RGB and HSL are exact round-trips. OKLCH involves a cube root and matrix multiplication, so converting to OKLCH and back can shift a channel by a unit or two of rounding — expected and visually imperceptible.
How is CMYK calculated, and will it match what a printer produces?
The tool uses the plain device formula: K is one minus the brightest RGB channel, and C, M and Y are what remains of each channel relative to that brightest one. Black is K 100% with no C, M or Y. There is no ICC profile, so the numbers will not match a press, a Photoshop or Illustrator export with a profile such as FOGRA or SWOP, or a printer's own conversion. Treat them as a starting point and proof in print. Results are rounded to whole percents, so converting back can shift a channel by a unit or two.
How do I type a CMYK color?
Use cmyk(c m y k) with commas or spaces. Bare numbers are percents (cmyk(0 50 100 0) is orange), and a % suffix works too. Four comma values are always C, M, Y and K, not three channels plus alpha. CSS-style device-cmyk() is also read, where bare numbers are 0 to 1 fractions. Values outside 0 to 100% are rejected rather than clamped. A slash alpha is accepted, but CMYK output ignores alpha.
Which alpha formats are supported?
Alpha is read from #rrggbbaa hex, from the fourth argument of rgba() / hsla(), and from the / value in space-separated rgb() and oklch(). The swatch shows it over a checkerboard, and an alpha below 1 adds a HEX + alpha row to the output.