In order to convert colors from HEX to CMYK, you must first convert hexadecimal code to decimal numbers.
In this example we'll be converting hexadecimal code#32A852
by splitting the code into pairs of two: 32 A8 52
, and converting each of the pair to a decimal number:
32 = 50 A8 = 168 52 = 82
#32A852 = RGB(50, 168, 82)
Now that we have RGB color RGB(50, 168, 82)
, we can convert it to a CMYK color mode.
We first divide RGB values by 255 to change the range from 0 - 255
to 0 - 1
:
R* => 0.2 = 50 / 255 G* => 0.66 = 168 / 255 B* => 0.32 = 82 / 255
We convert RGB to CMYK using these formulas:
Step 1: Calculate the black key color K::
K = 1 - MAX(R*, G*, B*): K = 1 - MAX(0.2, 0.66, 0.32) K = 0.34
Step 2: Calculate the cyan color C::
C = (1 - R* - K) / (1 - K) C = (1 - 0.2 - 0.34) / (1 - 0.34) C = 0.7
Step 3: Calculate the magenta color M:
M = (1 - G* - K) / (1 - K) M = (1 - 0.66 - 0.34) / (1 - 0.34) M = 0
Step 4: Calculate the yellow color Y:
Y = (1 - B* - K) / (1 - K) Y = (1 - 0.32 - 0.34) / (1 - 0.34) Y = 0.51
Step 5: Multiple each value by 100:
Cyan color (C): 70 Magenta color (M): 0 Yellow color (Y): 51 Black color (K): 34
Example #1: convert color red #FF0000
to CMYK:
HEX = #FF0000 RGB = (255, 0, 0) CMYK = (0, 100, 100, 0)
Example #2: convert color green #00FF00
to CMYK:
HEX = #00FF00 RGB = (0, 255, 0) CMYK = (100, 0, 100, 0)
Example #3: convert color blue #0000FF
to CMYK:
HEX = #0000FF RGB = (0, 0, 255) CMYK = (100, 100, 0, 0)
Example #4: convert color white #FFFFFF
to CMYK:
HEX = #FFFFFF RGB = (255, 255, 255) CMYK = (0, 0, 0, 0)
Example #5: convert color black #000000
to CMYK:
HEX = #000000 RGB = (0, 0, 0) CMYK = (0, 0, 0, 100)
You should use HEX color mode for designs that will be displayed on device screens and will not be physically printed. Whether they’ll be viewed on computer monitors, smartphone screens, or TVs - HEX color mode is your best pick.
Use HEX if your project requires
PNG: if your logo or graphic needs to be transparent, meaning it has no background, PNG is the perfect fit. Consider this file type for interface elements like buttons, banners, or icons.
JPEG: if your graphic does not need to be transparent, you should use this file format as it’s usually smaller in size and is a perfect format for images.
GIF: if you are using animated graphics such as moving logo or bouncing icon, or your image has any motion - this file type would is ideal.
It’s best to avoid TIFF, EPS, and PDF because these formats are not compatible with most software and are usually larger in size.
You should use CMYK for designs that will be physically printed and not viewed on screen. Whether you will be printing business cards, stickers, or logotypes - CMYK color mode will give you more accurate results.
Use CMYK if your project requires:
It’s always best to consult your printer provider to find out which file format they prefer. Usually, it’s PDF, AI (Adobe Illustrator) or EPS.