RGB to CMYK converter: the formula step by step, with examples
By TechCompare · Updated · How we check
rgb(239, 68, 68) comes out as cmyk(0%, 72%, 72%, 6%). Black is 1 minus the largest channel, and each other ink is the gap between its channel and that largest value, divided by it.
- CMYK
cmyk(0%, 72%, 72%, 6%) - HEX
#EF4444 - HSL
hsl(0, 84%, 60%)
The converter above turns red, green and blue into cyan, magenta, yellow and black percents. Type three whole numbers from 0 to 255, either plain or in the rgb(...) form. This page shows the math behind those percents, so you can check a number by hand or explain one to someone else.
How this is calculated
Divide each channel by 255 to scale it from 0 to 1. Find the largest of the three scaled values. Black (K) is 1 minus that largest value. Cyan, magenta and yellow each come from 1 minus their own channel, minus K, divided by 1 minus K. Then round each result to a whole percent. Because K is 1 minus the largest value, the same numbers reduce to something simpler: the largest value minus a channel, divided by the largest value. The two forms are the same math.
Take the example color, #EF4444, which is rgb(239, 68, 68). Red is the largest channel at 239, so black is 1 minus (239 divided by 255), which rounds to 6%. Cyan is the ink for red, so it's 0%. Magenta is (239 minus 68) divided by 239, which rounds to 72%, and yellow is (239 minus 68) divided by 239, which rounds to 72%.
Pure black needs its own rule. Its largest channel is 0, so K is 100%, and the divisor 1 minus K would be zero. The converter sets black to 100% with the other inks at zero, which gives cmyk(0%, 0%, 0%, 100%). Pure red is cmyk(0%, 100%, 100%, 0%), pure green is cmyk(100%, 0%, 100%, 0%) and white is cmyk(0%, 0%, 0%, 0%). This is the plain math behind the converter, not a press conversion. RGB and CMYK are device-dependent, so these numbers are a starting point, and the Hex to CMYK page covers the print handoff.
Verdict
Use the formula to check a converter number or to explain one to someone else. For a print file, treat this formula as the first step and convert with the printer's CMYK profile. The same three channels can give other percents in a different profile, so keep the RGB values as your source.
More Color scenarios
Related guides
Frequently asked questions
What is K in CMYK?
Why are the CMYK numbers for a gray only K?
Can the formula give a number above 100?
What does the converter do with 0, 0, 0?
Related tools
Contrast Checker
Check color contrast ratios for WCAG AA/AAA accessibility compliance.
Use toolJSON Formatter
Validate, format, and minify JSON. Browse it as a tree, run JSONPath queries, compare two documents, or validate against a JSON Schema.
Use toolAspect Ratio Visualizer
Visually compare width differences between 16:9, 21:9, and 32:9 monitors.
Use tool