XhCode Online Converter Tools

HEX TO CMYK

Hex:

C: M: Y: K:
#
R
G
B
H
S
B
OK
HEX to CMYK

To convert HEX to CMYK, you need to follow these steps:

Steps to Convert HEX to CMYK:
Convert HEX to RGB:
First, convert the HEX color code into the RGB format, as CMYK is derived from RGB values.

A HEX color code is in the format #RRGGBB, where RR, GG, and BB represent the Red, Green, and Blue components in HEX.
Convert each pair of HEX values into their RGB equivalents.
Normalize the RGB values:
Convert the RGB values (which range from 0 to 255) to a range of 0 to 1 by dividing each value by 255.

r' = R / 255
g' = G / 255
b' = B / 255
Calculate the Key (Black, K):
The Key (Black) component is the minimum of the normalized RGB values:

K = 1 - max(r', g', b')
Calculate Cyan, Magenta, and Yellow:
Once you have K, the Cyan, Magenta, and Yellow components can be calculated using the following formulas:

C = (1 - r' - K) / (1 - K)
M = (1 - g' - K) / (1 - K)
Y = (1 - b' - K) / (1 - K)
If K = 1, set C = M = Y = 0.

Convert to Percentages (optional):
You can multiply the resulting C, M, Y, and K values by 100 to express them as percentages.

Example 1: HEX #FF5733
Convert HEX to RGB:

FF (Red) = 255
57 (Green) = 87
33 (Blue) = 51
So, RGB = (255, 87, 51).

Normalize RGB:

r' = 255 / 255 = 1
g' = 87 / 255 ≈ 0.341
b' = 51 / 255 ≈ 0.2
Calculate Key (K):

K = 1 - max(1, 0.341, 0.2) = 1 - 1 = 0
Calculate Cyan (C), Magenta (M), and Yellow (Y):

C = (1 - 1 - 0) / (1 - 0) = 0
M = (1 - 0.341 - 0) / (1 - 0) = 0.659
Y = (1 - 0.2 - 0) / (1 - 0) = 0.8
CMYK = (0, 0.659, 0.8, 0) (or (0%, 66%, 80%, 0%))

Example 2: HEX #33CCFF
Convert HEX to RGB:

33 (Red) = 51
CC (Green) = 204
FF (Blue) = 255
So, RGB = (51, 204, 255).

Normalize RGB:

r' = 51 / 255 ≈ 0.2
g' = 204 / 255 ≈ 0.8
b' = 255 / 255 = 1
Calculate Key (K):

K = 1 - max(0.2, 0.8, 1) = 1 - 1 = 0
Calculate Cyan (C), Magenta (M), and Yellow (Y):

C = (1 - 0.2 - 0) / (1 - 0) = 0.8
M = (1 - 0.8 - 0) / (1 - 0) = 0.2
Y = (1 - 1 - 0) / (1 - 0) = 0
CMYK = (0.8, 0.2, 0, 0) (or (80%, 20%, 0%, 0%))

Example 3: HEX #800080
Convert HEX to RGB:

80 (Red) = 128
00 (Green) = 0
80 (Blue) = 128
So, RGB = (128, 0, 128).

Normalize RGB:

r' = 128 / 255 ≈ 0.502
g' = 0 / 255 = 0
b' = 128 / 255 ≈ 0.502
Calculate Key (K):

K = 1 - max(0.502, 0, 0.502) = 1 - 0.502 = 0.498
Calculate Cyan (C), Magenta (M), and Yellow (Y):

C = (1 - 0.502 - 0.498) / (1 - 0.498) = 0 / 0.502 = 0
M = (1 - 0 - 0.498) / (1 - 0.498) = 0.502 / 0.502 = 1
Y = (1 - 0.502 - 0.498) / (1 - 0.498) = 0 / 0.502 = 0
CMYK = (0, 1, 0, 0.498) (or (0%, 100%, 0%, 50%))