CSS Color Converter
Paste any CSS color, from #hex to oklch() or a name like tomato, and get it in every other CSS format at once.
Accepts #hex, rgb(), hsl(), hwb(), oklch(), named colors like tomato, and transparent.
-
hex
-
rgb
-
hsl
-
hwb
-
oklch
-
cmyk
Runs in your browser. What you enter is kept for 30 days to improve Toolgrid, then deleted.
How to use the CSS Color Converter
- 1 Paste or type a CSS color, such as rebeccapurple, hsl(200 60% 50%) or oklch(70% 0.15 145).
- 2 Check the swatch.
- 3 Copy the format you want to use.
About the CSS Color Converter
CSS has many ways to write the same color. This converter parses them like a browser: hex codes with 3 to 8 digits, rgb() and rgba() with numbers or percentages, hsl(), hwb(), oklch() with angles in deg, rad, grad or turn, the 148 named colors and transparent.
OKLCH is the newest format in CSS Color 4. Its lightness is perceptually even, so changing only the lightness gives smooth, predictable shades, which makes it popular for design systems.
Colors are calculated in sRGB. An oklch() value outside the sRGB range is clipped to the nearest displayable color, so converting it back may give slightly different numbers.
Frequently asked questions
Which formats does it understand?
Hex (#rgb, #rgba, #rrggbb, #rrggbbaa), rgb(), rgba(), hsl(), hsla(), hwb(), oklch(), named colors and transparent.
Does it handle the new space-separated syntax?
Yes, both rgb(255, 0, 0) and rgb(255 0 0 / 50%) work.
Why did my oklch color change slightly?
Some oklch colors fall outside sRGB, the color range of most screens; they are clipped to the nearest color that can be shown.
How many named colors does CSS have?
148, including duplicates such as gray and grey or aqua and cyan.