How CMYK to HSL conversion works
To describe an ink recipe in HSL, the converter first predicts its RGB with the naive formula, then measures hue, saturation and lightness from that RGB. Seeing a print colour as HSL makes it easy to reason about: which hue the inks produce, how light, and how vivid.
- CMYK → RGB: R = 255 × (1 − C)(1 − K), G = 255 × (1 − M)(1 − K), B = 255 × (1 − Y)(1 − K).
- R′, G′, B′ = RGB ÷ 255; Cmax, Cmin, Δ.
- L = (Cmax + Cmin) ÷ 2; S = Δ ÷ (1 − |2L − 1|).
- H from the largest channel, as for any RGB → HSL conversion.
Worked example: cmyk(0%, 45%, 90%, 5%) to HSL
Here is the converter's own calculation for cmyk(0%, 45%, 90%, 5%), step by step. The result, hsl(30, 89%, 52%), is exactly what the tool above shows for this input.
- As fractions: C = 0, M = 0.45, Y = 0.9, K = 0.05.
- R = 255 × (1 − 0) × (1 − 0.05) = 242.25 → 242.
- G = 255 × (1 − 0.45) × (1 − 0.05) = 133.24 → 133.
- B = 255 × (1 − 0.9) × (1 − 0.05) = 24.22 → 24.
- R′ = 242 ÷ 255 = 0.949, G′ = 0.522, B′ = 0.094.
- Cmax = 0.949, Cmin = 0.094, Δ = 0.855.
- L = (0.949 + 0.094) ÷ 2 = 0.522.
- S = 0.855 ÷ (1 − |2 × 0.522 − 1|) = 0.893.
- Red is largest: H = 60° × ((0.522 − 0.094) ÷ 0.855 mod 6) = 30°.
- Rounded:
hsl(30, 89%, 52%).
Magenta and yellow mixes in CMYK and HSL
Common ink recipes and what they become on screen.
| Colour | CMYK | HSL |
|---|---|---|
| M100 Y0 | cmyk(0%, 100%, 0%, 0%) | hsl(300, 100%, 50%) |
| M80 Y20 | cmyk(0%, 80%, 20%, 0%) | hsl(315, 100%, 60%) |
| M60 Y40 | cmyk(0%, 60%, 40%, 0%) | hsl(340, 100%, 70%) |
| M50 Y50 | cmyk(0%, 50%, 50%, 0%) | hsl(0, 100%, 75%) |
| M40 Y60 | cmyk(0%, 40%, 60%, 0%) | hsl(20, 100%, 70%) |
| M20 Y80 | cmyk(0%, 20%, 80%, 0%) | hsl(45, 100%, 60%) |
| M0 Y100 | cmyk(0%, 0%, 100%, 0%) | hsl(60, 100%, 50%) |
| M60 Y100 | cmyk(0%, 60%, 100%, 0%) | hsl(24, 100%, 50%) |
| M30 Y100 | cmyk(0%, 30%, 100%, 0%) | hsl(42, 100%, 50%) |
| M100 Y100 | cmyk(0%, 100%, 100%, 0%) | hsl(0, 100%, 50%) |
Precision test: every CMYK value through the converter
Across all 104,060,401 whole-number recipes the converter produces 2,048,030 distinct HSL values. Converting HSL back to CMYK gives the same colour 19.017% of the time (worst 5 levels), though usually with a different recipe.
Method: every whole-number CMYK value, through the converter's own code and back, compared on the 0–255 scale (how we test).
| Measure | Result |
|---|---|
| CMYK values tested | 104,060,401 |
| Distinct HSL results | 2,048,030 |
| Came back exactly | 19.017% |
| Largest change (0–255 levels) | 5 |
| Average change | 1.0759 |
Last updated · Source: Pixohub exhaustive test of lib/color-math.ts
Formula vs a real print profile
Mixing magenta and yellow in different proportions walks from magenta through red to yellow. The formula predicts screen-pure hues (#FF00FF for 100% magenta), but through the profile magenta ink is #D70A7D, a far less saturated colour. The largest per-channel difference was 130 levels.
The converter above uses the standard formula. To show what a colour-managed conversion does, we converted the same colours with LittleCMS 2.19 through the Generic CMYK profile that ships with macOS (relative colorimetric intent with black point compensation, the default in Photoshop). Your printer's profile will give different numbers again, but in the same direction.
| Recipe | C/M/Y/K | Formula | Profile |
|---|---|---|---|
| M100 Y0 | 0/100/0/0 | #FF00FF | #D70A7D |
| M80 Y20 | 0/80/20/0 | #FF33CC | #E0537D |
| M60 Y40 | 0/60/40/0 | #FF6699 | #E57D77 |
| M50 Y50 | 0/50/50/0 | #FF8080 | #EA8F73 |
| M40 Y60 | 0/40/60/0 | #FF9966 | #EDA26D |
| M20 Y80 | 0/20/80/0 | #FFCC33 | #F8C853 |
| M0 Y100 | 0/0/100/0 | #FFFF00 | #FFF100 |
| M60 Y100 | 0/60/100/0 | #FF6600 | #E67928 |
| M30 Y100 | 0/30/100/0 | #FFB200 | #F2B326 |
| M100 Y100 | 0/100/100/0 | #FF0000 | #D81F26 |
Last updated · Source: Pixohub test, macOS Generic CMYK Profile via LittleCMS
Where you'll use CMYK to HSL
Building a web palette from print inks
Converting a set of print builds to HSL shows their hue spread and lightness at a glance, useful when extending a print palette to the web.
Understanding overprints
The magenta-yellow mixes below show how two inks combine into reds and oranges, with hue moving roughly in step with the ratio.
CSS for print-derived colours
Writing the result as hsl() makes later adjustments (lighter hover, darker border) simple.
Common mistakes
- Reading S = 100% as a sign the colour will print vividly: it describes the formula's screen colour, not the ink.
- Assuming K changes hue: it only lowers lightness (and in the profile, saturation).
- Using these values to judge whether a print colour is in gamut.
- Converting HSL back and expecting the original ink recipe.