Format Code Now
/

Color Converter

WM-12

Paste a color in hex, rgb(), hsl(), hsv(), cmyk() or as a CSS name, and see it in every other format, with the nearest named CSS color.

Runs in your browser. Nothing is uploaded.

Colors, one per line

All formats

How to use it

  1. Paste one color per line, in any supported format.
  2. Read the block of results for each color: hex, rgb, hsl, hsv, cmyk and name.
  3. Copy the result or download it as a text file.

Formats it reads

Hex in 3, 4, 6 and 8 digits, rgb() and rgba() in comma or space syntax, hsl() and hsla(), hsv() and hsb(), cmyk(), and all 148 color names from the CSS Color 4 list, such as rebeccapurple. Hue can carry deg, grad, rad or turn units. Colors outside the allowed range are clamped. Each color is converted to 8-bit RGB first, and every other format is calculated from that.

Rounding and CMYK

HSL, HSV and CMYK are written in whole degrees and whole percent, so they are rounded and may not convert back to exactly the same RGB. The CMYK is the simple formula, not an ICC-profiled one, so it will not match what a printer or an image editor reports. An alpha is shown for formats that can hold it and left out of HSV and CMYK.

Nearest CSS color name

The page compares your color with all 148 CSS names by straight distance in RGB space and shows the closest, with the distance. A distance of 0 means an exact match, and names that share a value, such as aqua and cyan, are listed together. Plain RGB distance is not how people see color difference, so a name can be nearest by this measure and still look different to you. Nothing is uploaded.

Error messages and what to do

MessageWhat it meansFix
Line 1: "nope" is not a color. Use hex (#rgb, #rrggbb, #rrggbbaa), rgb(), hsl(), hsv(), cmyk() or a CSS color name.The line is not in a format the page reads.Use one of the listed formats.
Line 1: hue "50%" must be an angle, not a percentageThe hue of hsl() or hsv() cannot be a percentage.Write the hue in degrees.

Questions people ask

How do I convert a color between formats?

Paste it above in any format and the page shows hex, rgb(), hsl(), hsv() and cmyk() for it. Copy whichever you need. For a single format, the hex to RGB or RGB to hex pages on this site show only that one.

What is the difference between RGB, HSL and CMYK?

RGB mixes light, with red, green and blue channels from 0 to 255. HSL describes the same color as hue, saturation and lightness. CMYK uses ink amounts, cyan, magenta, yellow and black, as used in printing. Hex is RGB written in base 16.

Why is the CMYK different from my design app?

Color-managed apps and print tools convert through an ICC color profile that models real inks and paper. This page uses the simple formula, which ignores profiles, so the numbers differ. Use it for a rough guide and not for press-ready files.

How is the nearest color name chosen?

It finds the CSS color with the smallest distance to yours in RGB space. A distance of 0 is an exact match. Because RGB distance is not perceptual, treat the name as a hint.

Does it support named colors like tomato?

Yes. All 148 CSS color names from the CSS Color 4 list are read, including rebeccapurple and both gray and grey spellings, and converted to the other formats.

About this tool

Reads #rgb, #rrggbb, #rgba, #rrggbbaa, rgb()/rgba() in comma or space syntax, hsl()/hsla(), hsv()/hsb(), cmyk() and all 148 CSS named colors from the CSS Color 4 list. Each color is turned into 8-bit RGB first, then written as hex, rgb(), hsl(), hsv() and cmyk(). Every conversion goes through 8-bit RGB, so values are rounded: hex and RGB to whole numbers, HSL, HSV and CMYK to whole degrees and whole percent. Converting there and back can therefore land on a slightly different color. CMYK here is the naive formula (it takes the largest RGB channel as the black key), not an ICC-profiled conversion, so it will not match what a printer or a color-managed app produces. The nearest CSS name is the closest of the 148 by plain distance in RGB space, which is not a perceptual measure; names that share a color, such as gray and grey, are listed together. Alpha is carried through when the format can hold it (8-digit hex, rgba, hsla) and ignored by HSV and CMYK.

Format Code Now: free, no ads, no accounts. Your input stays in your browser.