CMYK and RGB are two different color models used for printing and digital displays, respectively. If you are working with design or web development, you may need to convert colors from CMYK to RGB.
What are CMYK and RGB?
- CMYK (Cyan, Magenta, Yellow, Black) is a subtractive color model used in printers. The more ink is added, the darker the color becomes.
- RGB (Red, Green, Blue) is an additive model used on screens. The more light is added, the brighter the colors.
Formula for converting CMYK → RGB
To convert CMYK to RGB, use the following formula:
- Determine the color values in the range from 0 to 1 (divide percentages by 100).
- Calculate the RGB values using the formula:
R = 255 × (1 - C) × (1 - K)
G = 255 × (1 - M) × (1 - K)
B = 255 × (1 - Y) × (1 - K)
Example code in JavaScript
function cmykToRgb(c, m, y, k) {
let r = Math.round(255 * (1 - c) * (1 - k));
let g = Math.round(255 * (1 - m) * (1 - k));
let b = Math.round(255 * (1 - y) * (1 - k));
return `rgb(${r}, ${g}, ${b})`;
}
console.log(cmykToRgb(0.2, 0.5, 0.0, 0.1)); // rgb(204, 115, 230)
Conversion tools
If you don't want to calculate manually, use our online converter CMYK to RGB.
Converting CMYK to RGB is necessary for accurate color display on screens. Always check the results after conversion to ensure color accuracy in your design. We also have a post on how to convert RGB to CMYK.