If you have ever pasted the same HEX color into three "HEX to CMYK" converters, you probably got three different answers. Then the printer sent a proof and it matched none of them.

I build small web tools, and this annoyed me enough to look under the hood. Most converters run the same one-line formula, and that formula doesn't know what paper or ink is.

The formula almost everyone uses

const k = 1 - Math.max(r, g, b); // r, g, b in 0..1 const c = (1 - r - k) / (1 - k); const m = (1 - g - k) / (1 - k); const y = (1 - b - k) / (1 - k); 

It's neat and reversible, and it describes no real press. It ignores:

  • dot gain: ink spreads on paper, so 50% coverage prints darker than 50%
  • ink limits: a press can't lay down 400% ink; ~300–340% is typical
  • the color of the paper and inks: process cyan isn't the cyan your screen shows
  • black generation: how much of a dark color should come from K vs. CMY

The black-generation problem is the easiest to see. Take a dark warm gray, Cool Gray 11 C:

Method CMYK
Formula C8 M4 Y0 K65
GRACoL 2013 (US coated press) C64 M52 Y46 K36
FOGRA51 (Europe coated press) C57 M47 Y38 K45

The formula puts almost everything on the black plate. On press that prints flatter and cooler than the real ink. The two press profiles disagree with each other too, mostly on how much black to use, and that is exactly why you should ask your printer which standard they print to.

Matching in the other direction is affected too

It also matters when you go from CMYK to a spot color. Plain C100 M0 Y0 K0 matches a different spot color depending on how you compute it:

  • formula → nearest is 3242 C
  • GRACoL press simulation → nearest is 801 C

Same input, a completely different recommendation. If you match against the screen preview instead of the printed result, you pick the wrong ink.

Some colors can't be printed in CMYK at all

Purple 2607 C is a good example. Converted properly:

  • GRACoL 2013: C83 M100 Y0 K11
  • FOGRA51: C79 M100 Y1 K5
  • formula: C33 M94 Y0 K53

Even the best build misses the target by about ΔE 6.7 on GRACoL and 3.3 on FOGRA51 (CIEDE2000; around 2–3 is where most people start to notice). No CMYK tweaking fixes that, because the color sits outside what four process inks can reach. Across 2,682 coated and uncoated spot colors I checked, 245 land more than ΔE 3 away on a GRACoL press.

A converter should tell you that rather than hand you a confident-looking number.

Doing it properly: ICC profiles

Printers describe their presses with ICC profiles, and standard ones exist:

  • GRACoL 2013 (CRPC6): typical US commercial coated printing
  • PSO Coated v3 (FOGRA51): the current European coated standard (successor to FOGRA39)

Photoshop and Illustrator convert through these with a color management engine. I used LittleCMS (via Pillow's ImageCms in Python) with relative colorimetric intent + black point compensation, the same defaults Photoshop uses.

The catch: I wanted this to run in the browser with no server and no uploads, and I didn't want to ship ICC files or a color engine to every visitor.

Precomputed lookup tables

So the heavy lifting happens once, at build time:

  1. sRGB → CMYK: a 33×33×33 grid run through the profile, stored as bytes (~144 KB per press). The browser does trilinear interpolation between grid points.
  2. CMYK → Lab (D50): a 13⁴ grid (~86 KB per press), interpolated in 4D. This lets the page simulate the printed color, measure ΔE against the target, and flag out-of-gamut colors.

At runtime it is just array lookups and a few multiplications. It's instant and works offline once loaded.

I spot-checked the output against Photoshop's own conversions and the numbers match. Near black, interpolation differs by 2–3% on a single channel, which is under ΔE 1 and invisible in print.

Two bugs worth knowing about if you try this

1. Pillow's LAB mode stores a* and b* as signed bytes. Read them as uint8 and every negative a/b value wraps around, so greens and blues come out with wildly wrong hues. Cast to int8.

2. uint8 * 100 overflows silently in NumPy. I scaled L* like this and quietly corrupted lightness for most colors. My test passed anyway, because the reference values were generated by the same code. Lesson: check color math against an independent source (I used Photoshop) rather than against your own pipeline.

The result

I put all of this into a free tool, PrintColorTools:

  • HEX / RGB → CMYK for both GRACoL and FOGRA51, with a print preview
  • Pantone-style code → CMYK, with an out-of-gamut warning and the ΔE you'd lose
  • CMYK → nearest spot colors, matched against the printed color
  • batch mode for a whole brand palette, and color picking from an image

A caveat, because it matters: the spot-color side uses approximate screen values from an open dataset, not licensed Pantone data, and the tool isn't affiliated with Pantone LLC. For anything brand-critical, still get a proof from your printer. The point is to start from numbers a press would recognize, not from a formula that ignores the press.

If you work on print files, I'd love to hear where the numbers look off to you.