1What a color code actually is (start from zero)

Your screen makes every color out of just three lights: red, green and blue. Crank all three to full and you get white; turn them all off and you get black; mix them at different strengths and you get everything in between — all 16,777,216 possible combinations (256 × 256 × 256). A color code is simply a way of writing down how much red, green and blue to use.

That's it. That's the whole foundation. Everything else — HEX, HSL, CMYK — is notation and convenience layered on top of those three channels. When you understand that, conversions stop being mysterious: you're always describing the same three-light mixture, just in different words.

The reason we have multiple formats is that different people think about color differently. A web developer pasting a color into CSS wants something short — that's HEX. A designer nudging "make it a bit brighter" wants a slider for brightness — that's HSL. A printer mixing ink wants to know how much cyan, magenta, yellow and black to lay down — that's CMYK. Same orange, four mindsets.

Our example color for this guide is #FF5733, a warm orange-red. We'll convert it every which way so you can watch one swatch wear four different costumes.

2The four formats: HEX, RGB, HSL and CMYK

HEX: RGB in base-16

#FF5733 is three pairs of hexadecimal digits: FF for red, 57 for green, 33 for blue. Each pair is one byte, from 00 (0) to FF (255). So HEX isn't a different color model at all — it's just RGB written compactly in base-16. #FF0000 and rgb(255, 0, 0) are identical; web code prefers HEX because six characters beat a whole function call.

RGB: the screen's native tongue

rgb(255, 87, 51) spells out the three light channels directly, each 0–255. Design tools, image editors and game engines think in RGB because it maps straight onto the hardware. If HEX is the shorthand, RGB is the longhand — same information, more typing.

HSL: the designer's format

hsl(10.6, 100%, 60%) describes color the way humans think: hue (0–360° around the color wheel), saturation (0–100%, how vivid), lightness (0–100%, how bright). Nobody thinks "I want 30% more green" — but "a bit brighter" or "less vivid" maps perfectly onto lightness and saturation. That's why designers reach for HSL when building palettes.

CMYK: the printer's format

cmyk(0%, 65.9%, 80%, 0%) is the reverse world: instead of adding light, you're layering cyan, magenta, yellow and black ("key") ink on paper, which subtracts light. Printers need this because ink physics is nothing like screen physics — a file that looks perfect in RGB can print dull or wrong if it was never converted.

FormatLooks likeWho uses itWhen to use it
HEX#FF5733Web developersCSS, HTML, any web code
RGBrgb(255, 87, 51)Designers, game devsScreen design, image editing
HSLhsl(10.6, 100%, 60%)DesignersBuilding palettes, tweaking brightness/vividness
CMYKcmyk(0%, 66%, 80%, 0%)PrintersFlyers, packaging, business cards — anything printed
Additive mixing: how screens build color R G B white magenta cyan yellow
Additive mixing: red + green + blue light at full strength makes white. Every screen color is a point inside these three overlapping circles.
The one-line summary: HEX and RGB are the same information in different costumes; HSL is the human-friendly remix; CMYK is the mirror-image world of ink on paper.

3Converting by hand: the exact math

You'll use the converter for real work, but doing it by hand once makes the formats click. HEX to RGB is a base-16 to base-10 conversion, one pair at a time:

decimal = first digit × 16 + second digit  (FF = 15×16 + 15 = 255)

RGB to CMYK figures out how much black ink the color already contains, then expresses the remaining ink relative to what's left:

K = 1 − max(R, G, B),   C = (1 − R − K) ÷ (1 − K) (same pattern for M and Y)
Worked example 1 — #FF5733 to RGB: FF → 15×16+15 = 255; 57 → 5×16+7 = 87; 33 → 3×16+3 = 51. Result: rgb(255, 87, 51).
Worked example 2 — rgb(255, 87, 51) to HSL: The hue lands at 10.6° (warm orange-red), saturation is a full 100%, lightness 60%: hsl(10.6, 100%, 60%).
Worked example 3 — rgb(255, 87, 51) to CMYK: No black ink needed (K = 0), heavy magenta and yellow: cmyk(0%, 65.9%, 80%, 0%).

Going the other direction — RGB to HEX — just divide each channel by 16: the quotient is the first hex digit, the remainder is the second. 87 ÷ 16 = 5 remainder 7 → "57". Once you've done it twice, it becomes mechanical.

Hue anchors: reading the color wheel

HSL's hue is a position on a 360° wheel. Memorize six anchors and you can read any hue value at a glance:

HueColorExample
0°Red#FF0000
60°Yellow#FFFF00
120°Green#00FF00
180°Cyan#00FFFF
240°Blue#0000FF
300°Magenta#FF00FF

Our example color's hue of 10.6° sits just past red toward yellow — which is exactly what orange-red should be. See a hue of 200°? That's between cyan (180°) and blue (240°) — a sky blue, like the #0EA5E9 in the reference below.

4Popular colors: the ready reference

A ready reference of colors you'll actually use — click a chip in the converter to load any of them:

ColorHEXRGBHSL
Red#FF0000rgb(255, 0, 0)hsl(0, 100%, 50%)
Orange#FF5733rgb(255, 87, 51)hsl(11, 100%, 60%)
Gold#FFD700rgb(255, 215, 0)hsl(51, 100%, 50%)
Green#22C55Ergb(34, 197, 94)hsl(142, 71%, 45%)
Sky#0EA5E9rgb(14, 165, 233)hsl(199, 89%, 48%)
Blue#2563EBrgb(37, 99, 235)hsl(221, 83%, 53%)
Navy#0F172Argb(15, 23, 42)hsl(222, 47%, 11%)
Purple#833AB4rgb(131, 58, 180)hsl(276, 51%, 47%)
Pink#E1306Crgb(225, 48, 108)hsl(340, 75%, 54%)
Black#000000rgb(0, 0, 0)hsl(0, 0%, 0%)
White#FFFFFFrgb(255, 255, 255)hsl(0, 0%, 100%)

Notice how the HSL column tells a story the HEX column can't: pink's hue of 340° sits just before red's 0°/360°, purple's 276° sits between blue and magenta, and navy is just a very dark, slightly desaturated blue. Once you read hue, palettes start making sense.

One color, four languages FF → 255 · 57 → 87 · 33 → 51 #FF5733 HEX · web code base-16 RGB rgb(255, 87, 51) RGB · screens three light channels hsl(11°, 100%, 60%) HSL · designers hue · vivid · bright cmyk(0, 66, 80, 0) CMYK · print four inks on paper same swatch, four ways to write it
The swatch never changes — only the notation does. #FF5733 in four formats, one identical orange-red.

5Screens vs print: RGB vs CMYK in real life

This is where color theory meets expensive mistakes. Screens emit light (additive RGB); paper reflects it (subtractive CMYK ink). Those are opposite physics, and the translation isn't perfect: CMYK has a smaller gamut than RGB, meaning some vivid screen colors simply cannot be printed.

The classic casualty is bright, saturated color — neon greens, electric blues, vivid oranges. On screen they glow; on paper they come back duller and flatter, because ink can't reproduce that intensity. If you're designing a logo, a flyer, or packaging, convert to CMYK before you fall in love with the color, not after the print shop calls.

Practical rules: design for screens in RGB/HEX; design for print in CMYK from the start. Never send an RGB file to a commercial printer and hope — the printer's software will convert it, and its conversion choices won't be yours. And if exact color matters (brand colors on packaging), ask the printer about spot colors (like Pantone), which are premixed inks rather than CMYK approximations.

Why prints look duller: the gamut gap CMYK printable RGB — everything a screen can show vivid colors here can't be printed CMYK's printable range sits entirely inside RGB's — the outer ring is screen-only.
The printable (CMYK) gamut is smaller than the screen (RGB) gamut. Colors in the outer ring look great on your monitor and disappoint on paper.
Rule of thumb: if it will ever be printed — business cards, flyers, merch, packaging — work in CMYK from the first sketch. Converting at the end is where the surprises live.

6Using colors in code: CSS, shorthand and transparency

A few CSS habits that save real time once you know the formats:

Real-world snippet: a button with a darker hover, done the HSL way — background: hsl(11, 100%, 60%); and on hover background: hsl(11, 100%, 48%);. Try doing that cleanly with HEX and you'll see why designers love HSL.

7Common mistakes to avoid

Easy to slip up on these:

8Pro tips

Small habits that save real time:

The 30-second version: HEX = base-16 RGB (same thing, shorter). HSL = hue + vividness + brightness (best for designing). CMYK = printer ink (use for anything printed). Convert print work to CMYK early, and never trust a screen color to survive the trip to paper unchecked.

Convert any color in seconds

Type a HEX, RGB, HSL or CMYK value and get the other three instantly — with a live preview and click-to-copy. Free, private, no signup.

🎨 Open the Color Converter

100% free · No account · Private by design

Watch: the color wheel in motion — hues melting into each other, nothing staying still.

9Frequently asked questions

How do I convert HEX to RGB?

Split the hex code into three pairs and convert each pair from base-16 to decimal. #FF5733 → FF = 255, 57 = 87, 33 = 51, so rgb(255, 87, 51). The converter above does it as you type.

What is the difference between HEX and RGB?

They describe the exact same color — HEX is just RGB written compactly in base-16. #FF0000 and rgb(255, 0, 0) are identical; web code prefers HEX, design tools often show RGB.

What does HSL stand for?

Hue (0–360° around the color wheel), Saturation (0–100%, how vivid), Lightness (0–100%, how bright). Designers love it because tweaking one slider — say, lightness — is intuitive.

When should I use CMYK instead of RGB?

Use CMYK for anything printed: flyers, packaging, business cards. Screens emit light (RGB); paper reflects it (CMYK ink). Convert before you send files to a printer.

Why does my printed color look different from my screen?

Screens mix light additively and can show brighter, more saturated colors than ink on paper. CMYK has a smaller gamut — some vivid screen colors simply cannot be printed.

How do I read a 3-digit hex code like #F53?

Double each digit: #F53 means #FF5533. It's a shorthand, not a different color — and it only works when each pair has two identical digits.

Keep exploring

Color codes are numbers underneath — these tools speak the same language: