StringMash.com

CMYK to hex converter

Ink percentages to a hex code and rgb(), with the working.

Conversion
13 characters
Updates as you type
Hex#FF8700
RGBrgb(255, 135, 0)
HSLhsl(32, 100%, 50%)
CMYKcmyk(0%, 47%, 100%, 0%)
Nearest CSS namedarkorange
Contrast with white2.41:1 (fails)
Contrast with black8.72:1 (AAA)
The swatch and working are below

Show the steps
Aa blackAa white
  1. Each channel is 255 × (1 − (ink × (1 − K) + K)), with K = 0.
  2. Red from cyan 0: 255. Green from magenta 0.47: 135. Blue from yellow 1: 0. Rounded to whole numbers, that's rgb(255, 135, 0).
  3. Write each number from 0 to 255 as two hex digits: divide by 16, and the answer and the remainder are the two digits (10 to 15 are A to F).
  4. Red: 255 ÷ 16 = 15 remainder 15, so FF.
  5. Green: 135 ÷ 16 = 8 remainder 7, so 87.
  6. Blue: 0 ÷ 16 = 0 remainder 0, so 00.
  7. Put them together after a #: #FF8700.
  8. Contrast: 2.41:1 against white and 8.72:1 against black, so black text reads better on it.

Using the converter

Type the four ink amounts in order, cyan, magenta, yellow and black, such as 0, 47, 100, 0. Percent signs are optional, and cmyk(0%, 47%, 100%, 0%) works too.

Values from 0 to 1, as CSS writes them, also work. If any value is over 1 the four are read as percentages.

The CMYK to RGB formula

Each screen channel is 255 × (1 − (ink × (1 − K) + K)), with cyan for red, magenta for green and yellow for blue. Black darkens all three. Each ink takes away its opposite colour of light.

For cmyk(0%, 47%, 100%, 0%), red is 255 × 1 = 255, green 255 × 0.53 = 135 and blue 0, so #FF8700. Rounding the percentages loses a little, so a colour that went to CMYK and back can come out one step off.

Why the printer may not match

Screens make colour by adding light. Printers take it away, laying four inks over white paper. The two can't reach all the same colours, so a bright screen orange or electric blue often prints duller.

The formula here is the simple one that knows nothing about your paper or press. It is the "naive" conversion the CSS Color specification describes for colours without a profile. A print shop uses an ICC colour profile for its own press instead, and the numbers it picks will differ a little, especially in deep blacks. Use these values as a starting point, and ask the printer for a proof when the colour really matters.

Questions

Will the hex code look like my printed sample?

Roughly. The real colour of a print depends on the paper and inks, which this formula doesn't know about.

What is cmyk(100, 0, 0, 0)?

#00FFFF, pure cyan on screen. Real cyan ink is a little darker than that.

Sources

Added and reviewed . What's new