gizmobench
BrowseDaily

Hex to CMYK

Paste a hex code to see its RGB channels and algebraic CMYK percentages. This page opens in HEX to CMYK mode even when another direction was saved. #0B7A85 gives RGB 11, 122, 133 and C 91.7%, M 8.3%, Y 0.0%, K 47.8%. The result includes the formula and notes about shorthand or dropped alpha.

HEX3, 4, 6 or 8 digits
R 11 G 122 B 133
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

hash optional, shorthand expanded, 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 does #0B7A85 convert to?
The code contains red 11, green 122 and blue 133. Its algebraic CMYK result is C 91.7%, M 8.3%, Y 0.0%, K 47.8%, whose printed percentages sum to 147.8%. The RGB round trip returns the same channels. No ICC profile is applied, so this is not a print preview.
Can I omit the hash or use shorthand?
Yes. Three, four, six and eight hex digits work in either case. For example, 0b7 expands to #00BB77 and gives C 100.0%, M 0.0%, Y 36.4%, K 26.7%. The result notes the expansion. A fourth or eighth alpha component is discarded with an explanation rather than retained in CMYK.
Does this give a Pantone match or a print-ready colour?
It gives algebraic CMYK percentages for the RGB channels in a hex code. It loads no Pantone library, printer profile, ink or paper data. A print job needs its destination profile, and a Pantone match needs the relevant library and a separate matching workflow.
Why does this page open the HEX box?
Its preset selects HEX to CMYK before the remembered direction is used. Typing a new hex value keeps that draft, while the preset alone does not replace your saved direction. Choose a direction yourself to save it when browser storage is available.

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.