Skip to content
AgileLogics

RGB to CMYK

Converts Red/Green/Blue values (0-255) into their Cyan/Magenta/Yellow/Key(black) equivalent.

How it works

Enter R, G, B values (e.g. 255, 0, 0) and click Convert.

How is RGB converted to CMYK?

RGB describes light added to a black screen; CMYK describes ink that subtracts light from white paper. The usual conversion first sets black (K) from the brightest RGB channel, then works out how much cyan, magenta and yellow are needed for the remaining color. This tool does exactly that, so rgb(30, 144, 255) becomes cmyk(88.2%, 43.5%, 0%, 0%).

It's the conversion you need when a color exists only in code, a screenshot or a UI theme (an rgb() value from browser dev tools, say) and someone has asked for it "in CMYK" for a printed piece.

The calculation, step by step

Take rgb(34, 139, 34), the CSS color forestgreen.

  1. Scale to 0–1: R = 34/255 = 0.133, G = 139/255 = 0.545, B = 0.133.
  2. Black: K = 1 − max(R, G, B) = 1 − 0.545 = 0.455.
  3. Cyan: (1 − 0.133 − 0.455) / (1 − 0.455) = 0.412 / 0.545 = 0.755.
  4. Magenta: (1 − 0.545 − 0.455) / 0.545 = 0.
  5. Yellow: same as cyan, 0.755, because blue equals red.
  6. Multiply by 100 and round to one decimal: cmyk(75.5%, 0%, 75.5%, 45.5%).

These are the same formulas the W3C lists for naive RGB-to-CMYK conversion in the CSS Color Module Level 5 draft, including the special case: when K is 100% (pure black), C, M and Y are set to 0 rather than divided by zero.

Why one ink is always zero

Look at step 4. Whichever channel is brightest sets K, and the ink for that channel then comes out as exactly zero. So every result from this tool uses at most two of the colored inks plus black. That's tidy, but it's not how print production usually separates color. Prepress software converting through an ICC profile chooses a black strategy for the specific press and often uses all four inks.

The same rule can produce ink totals a press would reject. A barely-red near-black, rgb(10, 0, 0), converts to 0% cyan, 100% magenta, 100% yellow and 96.1% black, almost 300% ink in total. A profile conversion would cap that. Use this formula to communicate a color, and let profile-aware software handle the final separation. The International Color Consortium publishes the profile specification those tools are built on.

Input formats the parser accepts

The parser looks for the first three numbers in what you type. Plain numbers must be between 0 and 255; a number followed by % must be between 0% and 100% and is scaled to 0–255, the way CSS reads rgb() percentages. That makes it flexible:

Input Result
rgb(30, 144, 255) cmyk(88.2%, 43.5%, 0%, 0%)
30 144 255 same
rgba(30, 144, 255, 0.5) same; alpha ignored
rgb(30 144 255 / 50%) same; alpha ignored
30.5, 144.2, 255 cmyk(88%, 43.5%, 0%, 0%); decimals allowed
rgb(100%, 50%, 0%) Read as 255, 127.5, 0, giving cmyk(0%, 50%, 100%, 0%)
30-144-255 cmyk(88.2%, 43.5%, 0%, 0%); a hyphen between numbers is a separator
256, 0, 0 Error: out of range
-30, 144, 255 Error: a leading minus makes the value negative

Percentages follow the CSS Color Module Level 4 rule that 100% equals 255, so rgb(100%, 50%, 0%) is the same orange as rgb(255, 128, 0) to within rounding. Only the % sign switches a value to the percentage scale, so rgb(100, 50, 0) without it is a much darker brown. Invalid input shows "Enter valid RGB values (0-255), e.g. rgb(30, 144, 255) or 30, 144, 255."

Quick reference

RGB CMYK
255, 0, 0 0%, 100%, 100%, 0%
128, 128, 128 0%, 0%, 0%, 49.8%
0, 0, 0 0%, 0%, 0%, 100%
255, 255, 255 0%, 0%, 0%, 0%

Grays come out as black ink only. 128 is 50.2% of 255, which is why mid gray needs 49.8% K rather than an even 50.

When to use it, and when not to

It's a good fit for print briefs, quoting jobs, rough mockups and explaining a color to someone who thinks in ink. It's the wrong tool for final separations, brand-critical colors or large solid areas of dark color. Those need a profile conversion and a proof, and for exact repeatability a spot color may be the better choice; RGB to Pantone suggests the nearest one from its table.

To preview a CMYK spec on screen, reverse the process with CMYK to RGB. If your color is a HEX code rather than rgb(), HEX to CMYK saves a step, and RGB to HEX gives you the compact web form of the same color.

Last updated

Frequently asked questions

How do you calculate CMYK from RGB?
Divide R, G and B by 255. Black is 1 minus the largest of the three. Then cyan = (1 − R − K) / (1 − K), magenta = (1 − G − K) / (1 − K) and yellow = (1 − B − K) / (1 − K). Multiply by 100 for percentages. rgb(34, 139, 34) gives 75.5% cyan, 0% magenta, 75.5% yellow and 45.5% black.
Why is one of C, M or Y always zero?
Because black is taken from the brightest channel, the ink for that channel always works out to zero. It's a property of this simple formula. Profile-based conversions in print software often use all four inks.
Can I enter rgb() with percentages?
Yes. As in CSS, a percentage is a share of 255, so rgb(100%, 50%, 0%) is read as rgb(255, 127.5, 0) and gives cmyk(0%, 50%, 100%, 0%). You can mix the two forms; plain numbers are still 0 to 255. Percentages above 100% show an error.
What happens to alpha in rgba()?
It's ignored. Only the first three numbers are used, so rgba(30, 144, 255, 0.5) and rgb(30 144 255 / 50%) both give the CMYK for the opaque color.
Is this accurate enough to send to a printer?
It's fine for a brief or a mockup. For final artwork, convert in software using your printer's ICC profile, or send RGB and let the print shop convert it, then check a proof.