RGB to CMYK Converter
#336699
A formula CMYK value is not a press-ready separation. Print work converts colour through an ICC profile made for one set of inks, paper and press, such as a FOGRA39 coated-paper profile, so a printer's or design app's CMYK for the same colour can differ. Converting the result back can also miss the starting channels by a few levels, because each ink is rounded to a whole percentage.
Going the other way? Convert CMYK inks back to RGB →
How do I convert RGB to CMYK?
RGB channel values become four ink percentages by formula: rgb(51, 102, 153) is cmyk(67%, 33%, 0%, 40%). Black comes first, from the largest channel; cyan, magenta and yellow then measure how far each channel falls short of that largest one.
- Type the three channel values into the box. rgb(51, 102, 153), 51 102 153 and 51,102,153 all read.
- Find the largest channel and work out black as (255 − largest) ÷ 255, so 153 gives 0.4.
- For each other ink, divide the largest channel minus that channel by the largest: cyan is (153 − 51) ÷ 153. This is the W3C formula (1 − R′ − K) ÷ (1 − K) in whole channel values.
- Round each ink to a whole percentage, a value exactly halfway rounding up, and write cmyk(C%, M%, Y%, K%).
- Copy the result, or swap the direction to turn the inks back into channel values.
This formula knows nothing about inks or paper; the RGB vs CMYK comparison explains why print workflows convert through an ICC profile instead.
RGB Values and Their CMYK Formula Results
The corners of the RGB range show the pattern. Each full channel removes one ink and white needs no ink at all. Mid grey lands on K alone, because the formula puts every grey on the black ink.
| RGB | CMYK |
|---|---|
| rgb(255, 255, 255) | cmyk(0%, 0%, 0%, 0%) |
| rgb(255, 0, 0) | cmyk(0%, 100%, 100%, 0%) |
| rgb(0, 255, 0) | cmyk(100%, 0%, 100%, 0%) |
| rgb(0, 0, 255) | cmyk(100%, 100%, 0%, 0%) |
| rgb(0, 255, 255) | cmyk(100%, 0%, 0%, 0%) |
| rgb(255, 0, 255) | cmyk(0%, 100%, 0%, 0%) |
| rgb(255, 255, 0) | cmyk(0%, 0%, 100%, 0%) |
| rgb(128, 128, 128) | cmyk(0%, 0%, 0%, 50%) |
Worked Example: rgb(51, 102, 153) to CMYK
rgb(51, 102, 153) needs every step: its largest channel is below 255, so black is not zero. The working takes black first, then cyan, magenta and yellow, and paints the colour beside the result.
#336699
Result: rgb(51, 102, 153) = cmyk(67%, 33%, 0%, 40%)
Rounded to whole percentages, the four inks give cmyk(67%, 33%, 0%, 40%). Sent back through the inverse formula it returns rgb(50, 103, 153), not rgb(51, 102, 153), because each ink was rounded to a whole percentage.
- rgb(51, 102, 153) as CMYK inks: cmyk(67%, 33%, 0%, 40%)
Check it in reverse
To check the result, turn the inks back into channel values; expect the numbers to come back close, not always identical.
Worked examples: RGB to CMYK
Each example gives the value first, then the working. Select a value to load it in the converter.
What is rgb(51, 102, 153) in CMYK?
rgb(51, 102, 153) comes out as cmyk(67%, 33%, 0%, 40%).
Black comes from the largest channel, 153: K is 40%. Cyan is 67%, magenta 33% and yellow 0%, each measured against it.
What is rgb(0, 0, 0) in CMYK?
rgb(0, 0, 0) comes out as cmyk(0%, 0%, 0%, 100%).
With every channel at 0, K is 100%. The formula then sets cyan, magenta and yellow to 0 instead of dividing by zero.
Every example above converts back through the inverse formula — send the same inks back through the RGB formula — though rounding each ink to a whole percentage can move a value by a step or two.
What the Formula Uses
Below are the rules this page follows, in the wording the site uses everywhere. The reference rows are the inks the converter writes, each a whole percentage within the range shown.
To convert RGB to CMYK by formula, divide each channel by 255 to get R′, G′ and B′; then K = 1 − max(R′, G′, B′), C = (1 − R′ − K) / (1 − K), M = (1 − G′ − K) / (1 − K) and Y = (1 − B′ − K) / (1 − K). When K is 1, pure black, C, M and Y are 0.
A gamut is the range of colours a device can produce. A screen and a printing press have different gamuts: very saturated screen colours can fall outside what inks can print, and some ink colours fall outside sRGB.
iToolHub writes cmyk(C%, M%, Y%, K%) with each ink rounded to a whole percentage, and a value exactly halfway rounds up.
| What | Value |
|---|---|
| The four inks | cyan, magenta, yellow, black |
| How many inks | 4 |
| Least ink | 0% |
| Most ink | 100% |
What Does the Formula Leave Out?
The Press and the Paper
The formula knows only the three channel values. A press-ready conversion also knows the inks, the paper and how much ink the press can lay down, which is why print work goes through a profile and why the value here is an estimate to start from.
Colours Ink Cannot Reach
A gamut is the range of colours a device can produce. A screen and a printing press have different gamuts: very saturated screen colours can fall outside what inks can print, and some ink colours fall outside sRGB. The formula still returns four percentages for such a colour, and nothing in those numbers says the colour is out of reach.
Black Comes From the Brightest Channel
K is set by the largest of the three channels, not by their average, so rgb(255, 0, 0) needs no black at all. The other three inks are measured against that same largest channel, never against a fixed 255.
Common Mistakes
- Dividing by 255 for cyan, magenta and yellow. Those three are measured against the largest channel, which is 255 only when some channel is full.
- Typing percentages for the channels. This page reads each channel as a whole number from 0 to 255, so 20% is refused rather than guessed at.
- Expecting the formula to match a print shop. Its software converts through a profile for its own press, so a different value is not an error in either answer.
- Reading 100% K as the only way to print black. The formula puts black on K alone, and a profile conversion can build the same area from all four inks.
Frequently Asked Questions
Is the RGB to CMYK formula accurate for print?
Not for a press. It gives the same answer on every device because it ignores the inks, the paper and the press, and those are what a press-ready conversion depends on: print work goes through an ICC profile, and its CMYK can differ from this result.
Do printers automatically convert RGB to CMYK?
Many do. The ICC notes that many printers have only an RGB interface, so even CMYK data is turned into RGB and then separated into the printer's own inks. For those printers the ICC suggests leaving the data in RGB.
Why can some RGB colours not be printed in CMYK?
A gamut is the range of colours a device can produce. A screen and a printing press have different gamuts: very saturated screen colours can fall outside what inks can print, and some ink colours fall outside sRGB.
Why does the CMYK result use whole percentages?
Whole percentages are what this page writes, and one percent is 2.55 channel levels. Converting back can therefore miss by a level or more: rgb(51, 102, 153) returns as rgb(50, 103, 153).
Yes, in the CMYK to RGB direction, though the channels that come back can differ slightly from yours.
Related Conversions
The rest of the family sits on the colour converter hub.