gizmobench
BrowseDaily

RGB to CMYK

Enter RGB channels, a hex code or CMYK percentages, then choose a conversion direction. RGB 11, 122, 133 becomes C 91.7%, M 8.3%, Y 0.0%, K 47.8%. The panels show the formula, a colour swatch and the total of the printed percentages. These are algebraic channel values; a printer profile is needed for a print separation.

RGB#0B7A85
hex #0B7A85
CMYKalgebraic
K = 1 - max(R,G,B)/255C = (1 - R/255 - K) / (1 - K)C 91.7%M 8.3%Y 0.0%K 47.8%total ink 147.8%round trip 11, 122, 133no ICC profile applied

Gamut, rule of thumb: no flag under this fixed channel rule. This does not establish that a colour is printable on a particular press.

Direction

three channels in, four percentages out, computed here with no colour management of any kind.

C
91.7%
M
8.3%
Y
0.0%
K
47.8%

RGB 11, 122, 133 is C 91.7%, M 8.3%, Y 0.0%, K 47.8%, 147.8% total ink, no ICC profile applied.

  • RGB 11, 122, 133#0B7A85
    C 91.7 M 8.3 Y 0.0 K 47.8
  • RGB 255, 0, 0pure red
    C 0.0 M 100.0 Y 100.0 K 0.0
  • RGB 0, 0, 0black
    C 0.0 M 0.0 Y 0.0 K 100.0
RGB to CMYK code in JavaScript and Python

These examples use the same algebraic channel mapping, with input validation. CMYK results keep full precision; round to one decimal for display. No ICC profile is applied.

JavaScript: RGB to CMYK

function rgbToCmyk(r, g, b) {
  if (![r, g, b].every(v => Number.isInteger(v) && v >= 0 && v <= 255)) {
    throw new RangeError("RGB channels must be integers from 0 to 255");
  }
  const x = Math.max(r, g, b);
  return x === 0 ? [0, 0, 0, 100] : [
    100 * (x - r) / x, 100 * (x - g) / x,
    100 * (x - b) / x, 100 * (1 - x / 255)
  ];
}

Python: RGB to CMYK and CMYK to RGB

import math

def rgb_to_cmyk(r, g, b):
    if any(type(v) is not int or not 0 <= v <= 255 for v in (r, g, b)):
        raise ValueError("RGB channels must be integers from 0 to 255")
    x = max(r, g, b)
    return [0, 0, 0, 100] if x == 0 else [
        100 * (x-r)/x, 100 * (x-g)/x,
        100 * (x-b)/x, 100 * (1-x/255)
    ]

def cmyk_to_rgb(c, m, y, k):
    if any(type(v) not in (int, float) or not math.isfinite(v)
           or not 0 <= v <= 100 for v in (c, m, y, k)):
        raise ValueError("CMYK percentages must be finite and from 0 to 100")
    return [math.floor(255 * (1-v/100) * (1-k/100) + 0.5)
            for v in (c, m, y)]
Accuracy. The straight algebraic conversion, computed from the channels you enter and printed with its formula. It is device independent, which is the honest limit: no ICC profile, no ink, no paper and no press is taken into account, so use it to convert and read channel values, never to predict what a printer will put on the page.

Both directions run on the arithmetic printed beside the result, in this browser, with nothing uploaded and no account. Hex reads with or without the hash, 3 and 4 digit shorthand is expanded, and an alpha channel is dropped with a line saying so, because CMYK has no alpha. A channel outside 0 to 255, a percentage outside 0 to 100 or a box past 64 characters is named and refused rather than quietly corrected. The four percentages add up to the total ink shown, which this algebra keeps under 300% for RGB inputs and never limits. Arbitrary CMYK input can total 400%. The 240% flag is a fixed display rule, not a universal press limit. The gamut rule of thumb checks a brightest RGB channel of at least 200 and two C, M or Y values of at least 50%; it measures no printer gamut. The direction and what you type stay in this browser when storage is available.

Common questions

What is the RGB to CMYK formula?
For RGB channels from 0 to 255, let x = max(R, G, B). If x is zero, the result is C = M = Y = 0 and K = 100. Otherwise C = 100 × (x - R)/x, M = 100 × (x - G)/x, Y = 100 × (x - B)/x and K = 100 × (1 - x/255). The converter prints each percentage to one decimal. This formula does not use a colour profile.
How do I convert CMYK to RGB or hex?
Choose CMYK to RGB or CMYK to HEX and enter four percentages from 0 to 100. Calculate R = 255 × (1 - C/100) × (1 - K/100), using M for G and Y for B, then round the RGB channels to whole numbers. Hex writes those channels as three two-digit hexadecimal values. An arbitrary CMYK combination need not return the same CMYK percentages after a round trip through RGB.
Does an RGB round trip preserve the channels?
The one-decimal percentages produced from an 8-bit RGB colour convert back to the same three integer RGB channels. For example, C 91.7%, M 8.3%, Y 0.0%, K 47.8% returns RGB 11, 122, 133 and #0B7A85. This is a channel-arithmetic property; it does not promise unchanged appearance across screens, colour profiles or printing processes.
What do the total-ink and gamut flags mean?
The total is the sum of the four displayed percentages. The 240% flag is a fixed flag in this tool, not a universal press limit, and it changes no values. The gamut rule of thumb flags a brightest RGB channel of at least 200 together with at least two algebraic C, M or Y values of at least 50%. It does not measure a printer gamut or establish whether a print will look duller. A colour without a flag is not certified printable.
Why does grey become black ink only?
This formula puts the shared part of the RGB channels into K. For #808080, the answer is C 0.0%, M 0.0%, Y 0.0%, K 49.8%. A colour-managed separation can distribute that grey differently depending on its destination profile and black-generation settings; the algebra here has neither.
Which hex codes are accepted?
Enter three, four, six or eight hexadecimal digits, with or without a leading hash and in either case. #0b7 expands to #00BB77. A fourth or eighth alpha component is dropped with a visible note; this tool converts colour channels without retaining transparency. Invalid lengths, non-hex characters and out-of-range channels are refused with an explanation.
When should I use RGB versus CMYK?
RGB channels describe additive red, green and blue colour for screen-oriented work; CMYK describes cyan, magenta, yellow and black process-ink channels. For a print file, use the destination colour profile and output requirements supplied for that job. The numbers from this page are useful for reading the algebra, while appearance also depends on the colour space and output device.
Can I convert RGB to CMYK for printing without losing colour?
This page calculates channel values and cannot create a print-ready colour separation. There is no universal RGB-to-CMYK conversion that preserves every displayed colour on every printer: some colours are outside a destination gamut. Soft proofing and a destination profile can show a simulated result, but this swatch is only an RGB screen swatch.
How do I change RGB to CMYK or CMYK to RGB in Photoshop?
In Photoshop desktop, open the image and choose Image > Mode, then CMYK Color or RGB Color. For a specific output profile, choose Edit > Convert to Profile and select the intended destination profile. Adobe recommends making a backup and finishing RGB edits before converting for print. This page supplies instructions and channel arithmetic; it does not edit a Photoshop document.
How do I change RGB to CMYK or CMYK to RGB in Illustrator?
In Illustrator desktop, open the document and choose File > Document Color Mode, then CMYK Color or RGB Color. Choose the mode for the intended output, and use the appropriate destination profile for print preparation. Changing document mode is different from converting a single channel value here; this page does not edit an Illustrator file.
Can it convert an image, PDF or InDesign document?
There is no file input or file export in this converter. It reads one colour value at a time and copies the resulting numbers. Images and PDF files need a colour-managed file workflow; InDesign documents can contain placed content with different colour spaces. Use the application and output settings for that document rather than treating one algebraic colour value as a file conversion.
Can it find a Pantone match or the closest print colour?
No Pantone library, colour-distance search or destination profile is loaded. A hex code describes RGB channels and does not identify one universal Pantone or CMYK print match. The displayed swatch and flags cannot determine the closest reproducible colour on a particular substrate.
Can I use it on a phone or without installing software?
The inputs and direction buttons work in a browser on desktop or mobile. Calculations use local arithmetic without uploading colour values. You do not need Photoshop or an account for this channel conversion. It does not provide a downloadable application or an image-file conversion.
Does it remember my values?
The tool stores your typed values and deliberately selected direction in this browser. Opening the HEX sub-page takes precedence over a remembered direction without saving that preset as your own choice. Blocking storage does not stop the conversion.

The straight algebraic conversion, computed from the channels you enter and printed with its formula. It is device independent, which is the honest limit: no ICC profile, no ink, no paper and no press is taken into account, so use it to convert and read channel values, never to predict what a printer will put on the page.