Skip to main content
Color & Image

HEX, RGB, HSL, CMYK: Which Color Format Actually Matters

Four formats are fighting for the same pixel, and each one solves a different problem. HEX is the clipboard of the web, RGB(A) is what browsers and canvas actually compute with, HSL is the format you write color systems in, and CMYK is the only answer when ink hits paper. Teams that mix them casually ship brand colors that don't match anywhere. Here's where each format earns its place — and the three round-trip mistakes that cost you the most time.

HEX: the interchange format

#4F46E5 tells the browser the same thing as rgb(79 70 229); the hex digits are the byte values in base 16. HEX won the web because it's short, unambiguous, and every design tool's copy-paste defaults to it. It's also the format that survives copy-paste: a color defined in Figma arrives in your CSS untouched.

Two details people forget. First, the shorthand: #418 expands to #441188, not #401800 — each digit doubles. Second, 8-digit HEX (#4F46E580) carries alpha, and it's supported in every browser since 2017, so rgba() is no longer the only compact way to write transparent color.

The trap: HEX is opaque in meaning. Staring at #4F46E5 tells you nothing about whether it's dark or saturated, so you can't derive a hover state, a muted variant, or a dark-mode sibling from it without converting first. That's the actual argument for the other formats — not that HEX is obsolete, but that it's a storage format, not a working format.

RGB(A): when code touches the channels

Anything computational wants RGB. Canvas blending, image processing, CSS filters, and color-interpolation math all operate on channel values. If you're averaging two colors or dimming one by a factor, you're doing arithmetic on R, G, and B — and the results make sense in no other base.

RGB's weakness is the one everyone has felt: lightness isn't a channel. Add 10% brightness by multiplying all three channels by 1.1 and the hue drifts — reds go orange-ish, blues go violet. Colors with identical perceived brightness sit at wildly different channel values, so "make it 10% lighter" has no clean expression in RGB. That's the problem HSL exists to solve.

HSL: the format for color systems and design tokens

HSL splits a color into hue (0–360° on the color wheel), saturation (0–100%), and lightness (0–100%). One hue at lightness 20, 50, and 80 gives you a dark mode color, a brand color, and a tint — guaranteed to look related, because they are related: same wheel position, same saturation.

This is why design-token systems and CSS custom properties love HSL. Write --brand: 244 79% 60% as HSL parts, then derive hover: 244 79% 52% and muted: 244 15% 92% by editing one number. Try doing that with a hand-picked HEX scale and you'll drift: human eye + editor = inconsistent ramp. HSL makes the ramp arithmetic so the eye only judges the output.

Know its limits: HSL is perceptually naive. At saturation 100%, HSL yellow appears far brighter than HSL blue at the same lightness number — which is why WCAG contrast ratios computed down the same "lightness" value produce wildly different readability. It's a good authoring format, not a good perception model.

CMYK: print, and only print

CMYK describes ink coverage, not light. The screen can't even represent it — every CMYK value on a display is being approximated through an ICC profile conversion. Two consequences matter:

  • Gamut loss. sRGB displays cover roughly a third of the colors the human eye distinguishes, and print CMYK covers a narrower slice still. Saturated brand colors — most notably vivid blue and orange — fall outside CMYK gamut. That logo that pops on screen prints duller. Plan for it; don't discover it on 5,000 copies.
  • The black trap. "Black" printed as C=0 M=0 Y=0 K=100 is a thin, weak gray-black. Print shops specify rich black — typically C=60 M=40 Y=40 K=100 — for large fills. Meanwhile small text must stay 100% K monochrome, because registration drift on a four-ink pass makes C=M=Y-K text look blurry.

So: hand a designer CMYK values for print collateral and RGB/HEX for web, and convert deliberately — not by copying screen pixel values into a print spec. For spot-checking a single value, a dedicated converter such as the CMYK to RGB tool is faster than opening print drivers or a design suite.

The three round-trip mistakes that cost real time

  • CMYK numbers typed into CSS. background: cmyk(0%, 30%, 94%, 0%) is invalid in CSS — browsers drop the rule, and the element renders with whatever it inherited. The failure is silent: no error in the console worth hunting, just an off-color block. Convert first; the formats don't interop.
  • Round-trip drift in tooling. HEX → HSL → tweak → back to HEX is lossy in most editors when the intermediate is stored as integers: converting again can shift each channel by ±1–2, and after five round trips the "unchanged" brand color is measurably different. Define canonical values once and store them in one format; convert on demand with a precise tool like the HEX/RGB/HSL converter, never through a screenshot color picker.
  • Trusting HSL lightness for accessibility. A lightness-50 background with a lightness-20 text color reads fine on paper and can still fail WCAG — real luminance depends on the channels, not the L number. After deriving a dark-mode palette from HSL math, run the pairs through a contrast checker before committing them as tokens. This is the single most common a11y regression in dark modes.

A workflow that stays consistent

  1. Define brand colors once in HEX (canonical storage, copy-paste compatible).
  2. Author variations — hover states, tints, dark-mode ramps — in HSL, derived by editing one channel.
  3. Do any blending or dynamic manipulation in RGB(A), where the math lives.
  4. Before any print handoff, convert deliberately to CMYK and eyeball the gamut shift on brand-critical colors.
  5. Validate every text/background pair against WCAG ratios — regardless of which format authored them.

Keep a converter reachable: a browser tab of the color converter beats mental hex math every single time, and it beats the "wait, why is this slightly different than the design?" loop that eats the last hour before a launch.