A printer's color read the way a web designer would
CMYK says how much cyan, magenta, yellow and black ink to put on paper. HSL describes a screen color the way we perceive it: a hue, given as an angle from 0 to 360° on the color wheel, plus saturation and lightness as percentages. This CMYK to HSL converter links the two. The HSL to CMYK converter makes the return trip, to send an adjusted shade back to print.
The benefit is practical. Once a color from a printed brand guide is expressed in HSL, deriving variants in a stylesheet is easy: keep the hue, raise the lightness for a pale background, lower it for a button hover state. To build a full range around this color, the color palette generator suggests matching shades; if you only need the web code, go through the CMYK to HEX converter.
Using the converter
- Enter the four CMYK values, separated by commas or spaces:
0%, 20%, 60%, 20%or0 20 60 20. The color picker fills the field too. - The value
hsl(40, 54%, 56%)appears as you go, next to a preview. Processing happens in the browser, with no exchange with a server. - The "Copy" button puts the value on your clipboard, ready for CSS. HEX and RGB are given on the following lines.
A two-stage calculation
There is no direct formula: the conversion goes through RGB. For the sand yellow cmyk(0%, 20%, 60%, 20%):
- RGB: R = 255 × 1 × 0.8 = 204; G = 255 × 0.8 × 0.8 = 163.2, so 163; B = 255 × 0.4 × 0.8 = 81.6, so 82.
- Divide by 255: 0.800, 0.639 and 0.322. The maximum is 0.800, the minimum 0.322, the gap 0.478.
- Lightness: (0.800 + 0.322) / 2 = 0.561, so 56%.
- Saturation: 0.478 / (1 − |2 × 0.561 − 1|) = 0.478 / 0.878 = 0.544, so 54%.
- Hue: red is the strongest channel, so 60 × (0.639 − 0.322) / 0.478 = 39.8, so 40°.
| Color | CMYK | HSL |
|---|---|---|
| Red | 0%, 100%, 100%, 0% | hsl(0, 100%, 50%) |
| Cyan | 100%, 0%, 0%, 0% | hsl(180, 100%, 50%) |
| Magenta | 0%, 100%, 0%, 0% | hsl(300, 100%, 50%) |
| Pine green | 100%, 0%, 50%, 50% | hsl(150, 100%, 25%) |
| Gray | 0%, 0%, 0%, 50% | hsl(0, 0%, 50%) |
Frequently asked questions
Is this HSL color true to the printed piece?
It gives the idea, not a copy. The conversion assumes ideal inks on perfectly white paper. In a print shop, the match between CMYK and screen goes through an ICC profile (SWOP, FOGRA or the one for the chosen paper), and the result is usually less saturated than what the tool shows. If you need a website to match an existing printed piece, ask the printer for the profile or compare by eye against a paper copy.
Is black (K) just lightness (L) turned upside down?
No. A red with no black, 0%, 100%, 100%, 0%, has a lightness of 50%, exactly like a gray made of 50% black. Lightness depends on both the strongest and the weakest channel, whereas K only looks at the strongest.
Why do grays and black have a hue of 0?
A gray has no dominant color: its saturation is 0% and hue has no meaning. The tool writes 0 by convention, hence hsl(0, 0%, 0%) for the black 0%, 0%, 0%, 100%.