Hex to CMYK converter: turn a hex code into CMYK percentages for print

By TechCompare · Updated · How we check

#4F46E5 comes out as cmyk(66%, 69%, 0%, 10%) with the converter's formula. Treat those four percents as a starting point, since mapping between devices accurately takes an ICC profile.

  • CMYKcmyk(66%, 69%, 0%, 10%)
  • RGBrgb(79, 70, 229)
  • HSLhsl(243, 75%, 59%)

CMYK is the four-ink model used in print: cyan, magenta, yellow and black. Screens mix red, green and blue light, so a hex code like #4F46E5 needs translating before a printer can use it. The converter above does that translation with a simple formula. That formula is quick, but it knows nothing about the inks or paper a printer uses.

Conversion
HEX to CMYK
Example: #4F46E5
Category
Print Formats
Color knowledge base

How this is calculated

Start by splitting the hex code into red, green and blue. The largest of those three channels sets black, which is called K. The closer that largest channel gets to full, the less black you get. Cyan, magenta and yellow are what's left once the black is taken out. Each of those inks is how far its channel falls short of the largest one, measured as a share of that largest one. The ink that matches the largest channel is therefore always zero. Red's ink is cyan, green's is magenta and blue's is yellow.

Take #4F46E5, which is rgb(79, 70, 229). Blue is the largest channel at 229, so black is 1 minus (229 divided by 255), which rounds to 10%. Yellow is the ink that matches blue, so it's 0%. Cyan is 66% and magenta is 69%.

Turning cmyk(66%, 69%, 0%, 10%) back into hex gives #4E47E6, not #4F46E5, because each percent is rounded to a whole number. Keep the hex code as the master copy. The converter uses no ink, paper or ICC profile. Wikipedia's CMYK article says RGB and CMYK are device-dependent and that no universal formula converts between them, so a printer's profile can give other numbers for the same color. For why screen colors can look different on paper, see RGB vs CMYK.

Verdict

Use these percents for layout, planning and quick comparisons. Before a file goes to print, ask the printer which CMYK profile they use, convert with it and check a printed proof. A simple formula can't show how the printed result will look.

More Color scenarios

Hex to RGB
A hex color code is three RGB numbers written in base 16.
View details
RGB vs CMYK
Screens add light and print adds ink. See one color in both, and why a plain CMYK formula can't promise a print match.
View details
HSL color model
Hue, saturation and lightness, with three live sliders and a table of common colors in hex, RGB and HSL.
View details

Frequently asked questions

Will this converter match my design software's CMYK numbers?
Not always. The converter uses a simple formula with no profile, while other tools often convert through one. Two tools can then give different percents for the same hex code. For print work, get the profile from your printer and convert with that.
Why is black so low for a bright color?
Black is 1 minus the largest channel, so a color with a channel near full has little or no black. Pure yellow is cmyk(0%, 0%, 100%, 0%), with black at 0%, because its largest channel is already at full strength.
Can I use cmyk() in CSS?
No. Browsers don't read cmyk(...) in a stylesheet, and CSS has no plain cmyk() color function. Keep the converter's CMYK text for notes, specs and handoff, and write your CSS with hex, rgb() or oklch(). MDN's color value page lists the CSS color functions.
What hex code does 100% cyan give?
The plain formula maps 100% cyan, with no other ink, to #00FFFF, which is rgb(0, 255, 255). The converter writes that same color as cmyk(100%, 0%, 0%, 0%).