HEX vs RGB vs HSL vs CMYK: Which Color Code Should You Use?
Open any design file and you will find the same color written three different ways. The brand guide says #C8A97E, the developer’s stylesheet says rgb(200 169 126), and the printer wants CMYK percentages. They can all describe the same color, but they were built for different jobs. Knowing why each format exists makes it much easier to pick the right one and to avoid the classic mistake of sending screen colors to a print shop.
RGB: how screens actually make color
Every pixel on your monitor or phone is made of three tiny light sources: red, green and blue. Mixing them at different intensities produces every color the screen can show. That is why RGB is called an additive model: adding all three at full power gives white, and turning them all off gives black.
On the web each channel is stored as a number from 0 to 255, which is one byte. Three bytes give 256 × 256 × 256 = 16,777,216 possible colors. In CSS you can write it as rgb(200, 169, 126) or, in the newer space-separated syntax, rgb(200 169 126). Add a fourth value for transparency: rgb(200 169 126 / 50%).
HEX: the same numbers in a shorter form
A HEX code is not a different color model at all. It is RGB written in hexadecimal (base 16). Each pair of characters is one channel:
C8= 200 (red)A9= 169 (green)7E= 126 (blue)
HEX became the default on the web because it is compact, easy to copy and has been supported since the earliest versions of HTML. Shorthand like #FFF expands to #FFFFFF, and an eight-digit HEX such as #C8A97E80 adds an alpha channel (80 in hex is 128, about 50% opacity).
The downside is that HEX is hard to read. Looking at #C8A97E, very few people can tell you it is a warm, muted beige, or how to make it 10% darker.
HSL: color the way people think about it
HSL stands for hue, saturation and lightness. It describes the same RGB colors in terms humans understand:
- Hue is the position on the color wheel, from 0° to 360° (0 is red, 120 is green, 240 is blue).
- Saturation is how intense the color is, from 0% (grey) to 100% (fully vivid).
- Lightness runs from 0% (black) through 50% (the pure color) to 100% (white).
Our beige becomes hsl(35 40% 64%). Now it is obvious: an orange-yellow hue, low saturation, fairly light. Want a darker version for a hover state? Lower the lightness to 54%. Want a matching set of colors? Keep saturation and lightness and change only the hue. That is why many design systems define colors in HSL, and why our color palette generator works in HSL internally.
HSL has one known weakness: its lightness is not perceptual. A yellow and a blue at 50% lightness look very different in brightness. Newer CSS color spaces like OKLCH fix this, but HSL is still the most widely understood.
HSV / HSB: the picker in your design app
HSV (hue, saturation, value), also called HSB (brightness), is a close cousin of HSL. The difference is in the third value. In HSV, 100% value means the brightest version of the color, while 100% lightness in HSL always means white. Photoshop, Figma and most color pickers use HSV because it maps neatly onto a square picker: saturation left to right, brightness top to bottom.
You rarely type HSV into code, but it is useful when you need to recreate a color someone picked in a design app.
CMYK: color for ink on paper
Printers do not emit light; they lay ink on white paper, and the ink absorbs (subtracts) parts of the light that hits it. CMYK uses four inks: cyan, magenta, yellow and key (black). This is a subtractive model. Mixing all inks gives a dark, muddy near-black, which is why a separate black ink exists for crisp text and deep shadows.
CMYK is written as four percentages, for example cmyk(0%, 16%, 37%, 22%). The important thing to understand is that there is no single correct conversion from RGB to CMYK. The result depends on the paper, the press and the ink set, which is described by an ICC color profile such as FOGRA39 (common in Europe) or GRACoL (common in the US). Formula-based conversions, like the one in the color converter above, are a good starting point, but final print files should be converted in a design application using the profile your printer specifies.
Some screen colors, especially bright greens, oranges and electric blues, simply cannot be printed with standard CMYK inks. They fall outside the printable gamut and will look duller on paper.
Side-by-side comparison
| Format | Example | Model | Best for | Main drawback |
|---|---|---|---|---|
| HEX | #C8A97E | RGB (additive) | Brand guides, CSS, copying values | Not human-readable |
| RGB | rgb(200 169 126) | Additive light | CSS, transparency, image processing | Hard to adjust by eye |
| HSL | hsl(35 40% 64%) | Cylindrical RGB | Theming, tints and shades in CSS | Lightness isn’t perceptual |
| HSV/HSB | hsv(35, 37%, 78%) | Cylindrical RGB | Design app color pickers | Not used in CSS |
| CMYK | cmyk(0, 16, 37, 22) | Subtractive ink | Print production | Depends on paper and press |
Which one should you use?
For websites and apps, store colors as HEX or RGB in your design tokens because every tool understands them. Switch to HSL when you need to generate variations: hover states, disabled states, light backgrounds. If you are building a full design system, see our guide to building color scales.
For print, design in your layout application’s CMYK mode from the start, or convert using the printer’s ICC profile. Ask for a printed proof whenever color accuracy matters, for example for packaging or a logo.
For handoff between people, include at least HEX and CMYK in the brand guide, and add a Pantone reference if the brand uses spot colors. That way a web developer, a social media manager and a sign maker can all work from the same source.
Common mistakes to avoid
- Sending RGB images to a commercial printer. Most print workflows convert automatically, but the shift can surprise you. Check bright colors in a proof.
- Assuming HEX and RGB look the same everywhere. They are the same numbers, but uncalibrated monitors display them differently. A brand color can look slightly different on a phone and an office monitor.
- Making colors darker by lowering all RGB values equally. This shifts the hue and saturation as well. Lowering HSL lightness, or using a tints and shades generator, gives more predictable results.
- Forgetting contrast. Whatever format you use, text colors must meet accessibility contrast ratios. Run every text and background pair through a contrast checker.
Quick conversion tips
To convert a HEX value to RGB by hand, split it into pairs and convert each from base 16: the first digit times 16 plus the second digit (with A=10 up to F=15). C8 is 12 × 16 + 8 = 200. For anything beyond that, a converter saves time and avoids typos.