How RGB to CMYK conversion works
The textbook RGB to CMYK formula takes black (K) from how dark the colour is, then works out how much cyan, magenta and yellow are needed to subtract the remaining light. It ignores the paper, the inks and how they overlap, which is exactly what an ICC profile describes, so treat the result as a starting point.
- R′, G′, B′ = channel ÷ 255.
- K = 1 − max(R′, G′, B′).
- C = (1 − R′ − K) ÷ (1 − K); M = (1 − G′ − K) ÷ (1 − K); Y = (1 − B′ − K) ÷ (1 − K).
- When K = 1 (pure black), C = M = Y = 0.
- Multiply each by 100 and round.
Worked example: rgb(128, 0, 128) to CMYK
Here is the converter's own calculation for rgb(128, 0, 128), step by step. The result, cmyk(0%, 100%, 0%, 50%), is exactly what the tool above shows for this input.
- R′ = 128 ÷ 255 = 0.502, G′ = 0, B′ = 0.502.
- K = 1 − max(R′, G′, B′) = 1 − 0.502 = 0.498.
- C = (1 − 0.502 − 0.498) ÷ (1 − 0.498) = 0; M = 1; Y = 0.
- Rounded to percent:
cmyk(0%, 100%, 0%, 50%).
The 16 basic HTML colours in RGB and CMYK
The original sixteen colour keywords from HTML 4, still valid CSS named colours.
| Colour | RGB | CMYK |
|---|---|---|
| black | rgb(0, 0, 0) | cmyk(0%, 0%, 0%, 100%) |
| silver | rgb(192, 192, 192) | cmyk(0%, 0%, 0%, 25%) |
| gray | rgb(128, 128, 128) | cmyk(0%, 0%, 0%, 50%) |
| white | rgb(255, 255, 255) | cmyk(0%, 0%, 0%, 0%) |
| maroon | rgb(128, 0, 0) | cmyk(0%, 100%, 100%, 50%) |
| red | rgb(255, 0, 0) | cmyk(0%, 100%, 100%, 0%) |
| purple | rgb(128, 0, 128) | cmyk(0%, 100%, 0%, 50%) |
| fuchsia | rgb(255, 0, 255) | cmyk(0%, 100%, 0%, 0%) |
| green | rgb(0, 128, 0) | cmyk(100%, 0%, 100%, 50%) |
| lime | rgb(0, 255, 0) | cmyk(100%, 0%, 100%, 0%) |
| olive | rgb(128, 128, 0) | cmyk(0%, 0%, 100%, 50%) |
| yellow | rgb(255, 255, 0) | cmyk(0%, 0%, 100%, 0%) |
| navy | rgb(0, 0, 128) | cmyk(100%, 100%, 0%, 50%) |
| blue | rgb(0, 0, 255) | cmyk(100%, 100%, 0%, 0%) |
| teal | rgb(0, 128, 128) | cmyk(100%, 0%, 0%, 50%) |
| aqua | rgb(0, 255, 255) | cmyk(100%, 0%, 0%, 0%) |
Source: W3C CSS Color Module Level 4
Precision test: every RGB value through the converter
Within the formula, whole-number CMYK maps all 16,777,216 RGB colours onto 2,463,617 ink recipes, and 12.735% of colours come back exactly, never more than 2 levels off. The bigger story is in the next table.
Method: every whole-number RGB value, through the converter's own code and back, compared on the 0–255 scale (how we test).
| Measure | Result |
|---|---|
| RGB values tested | 16,777,216 |
| Distinct CMYK results | 2,463,617 |
| Came back exactly | 12.735% |
| Largest change (0–255 levels) | 2 |
| Average change | 0.9311 |
Last updated · Source: Pixohub exhaustive test of lib/color-math.ts
Formula vs a real print profile
The 16 basic HTML colours show the formula's blind spots. Black is 0/0/0/100 by formula but 75/71/65/80 through the profile: a rich black of 291% total ink, because the profile adds cyan, magenta and yellow under the black for a deeper result. Across these colours the two methods differed by up to 75 points on a single ink.
The converter above uses the standard formula. To show what a colour-managed conversion does, we converted the same colours with LittleCMS 2.19 through the Generic CMYK profile that ships with macOS (relative colorimetric intent with black point compensation, the default in Photoshop). Your printer's profile will give different numbers again, but in the same direction.
| Colour | HEX | Formula C/M/Y/K | Profile C/M/Y/K | Profile total ink |
|---|---|---|---|---|
| black | #000000 | 0/0/0/100 | 75/71/65/80 | 291% |
| silver | #C0C0C0 | 0/0/0/25 | 22/17/15/0 | 54% |
| gray | #808080 | 0/0/0/50 | 50/43/39/2 | 134% |
| white | #FFFFFF | 0/0/0/0 | 0/0/0/0 | 0% |
| maroon | #800000 | 0/100/100/50 | 14/90/93/38 | 235% |
| red | #FF0000 | 0/100/100/0 | 0/84/93/1 | 178% |
| purple | #800080 | 0/100/0/50 | 54/98/1/4 | 157% |
| fuchsia | #FF00FF | 0/100/0/0 | 31/59/0/0 | 90% |
| green | #008000 | 100/0/100/50 | 69/8/98/25 | 200% |
| lime | #00FF00 | 100/0/100/0 | 41/0/60/0 | 101% |
| olive | #808000 | 0/0/100/50 | 24/16/96/32 | 168% |
| yellow | #FFFF00 | 0/0/100/0 | 6/0/69/0 | 75% |
| navy | #000080 | 100/100/0/50 | 97/83/7/21 | 208% |
| blue | #0000FF | 100/100/0/0 | 87/67/0/0 | 154% |
| teal | #008080 | 100/0/0/50 | 84/19/39/13 | 155% |
| aqua | #00FFFF | 100/0/0/0 | 39/0/14/0 | 53% |
Last updated · Source: Pixohub test, macOS Generic CMYK Profile via LittleCMS
Where you'll use RGB to CMYK
Preparing artwork for offset printing
Convert in your layout application using the printer's profile and check the result in a soft-proof. Use this page to understand roughly what will happen, not as final separations.
Estimating ink-heavy designs
Dark backgrounds converted through a profile can carry close to 300% ink. If you're printing on uncoated paper, ask the printer for their total ink limit before converting.
Matching a spot colour
If a brand colour must be exact in print, specify a spot ink from a physical swatch book rather than a CMYK build; CMYK can only approximate many saturated colours.
Common mistakes
- Sending small black text as converted rich black: four plates must line up perfectly, so text can look fuzzy. Use 100% K for text.
- Using registration black (100/100/100/100) as a design colour: 400% ink smears and won't dry properly.
- Converting an image to CMYK several times with different tools: each conversion clips colours, and the losses add up.
- Judging the printed colour on an uncalibrated screen; use a hard proof for anything colour-critical.