· Igor Ilic

Color conversion guide: HEX, RGB, HSL, and CMYK explained

Why color conversion matters

A HEX code that looks perfect in CSS might need to become CMYK for print, or HSL for programmatic manipulation. Each format serves a different purpose.

The four color models

HEX (hexadecimal)

The most common format in web development. Six hex digits represent RGB channels: #RRGGBB.

#FF6B35  →  Red=255, Green=107, Blue=53
#F60     →  shorthand for #FF6600

RGB (red, green, blue)

An additive model where each channel goes from 0 to 255. Used in CSS via rgb(r, g, b). RGB is device-dependent — the same values look different on different screens.

HSL (hue, saturation, lightness)

More intuitive for humans to work with:

  • Hue — a degree on the color wheel (0° = red, 120° = green, 240° = blue)
  • Saturation — 0% (gray) to 100% (full color)
  • Lightness — 0% (black) to 100% (white), with 50% being pure color

HSL makes it easy to create color schemes by keeping hue constant and varying saturation and lightness.

CMYK (cyan, magenta, yellow, key/black)

A subtractive model used for print. Values are percentages from 0% to 100%. Converting RGB to CMYK is essential when preparing digital designs for physical printing.

Quick reference table

FormatBest forExample
HEXCSS, HTML, design tools#FF6B35
RGBCSS, digital displaysrgb(255, 107, 53)
HSLDynamic color schemeshsl(16, 100%, 60%)
CMYKPrint, brochures, flyerscmyk(0%, 58%, 79%, 0%)

Create color schemes with HSL

HSL is excellent for generating palettes programmatically:

:root {
  --primary: hsl(200, 80%, 50%);
  --primary-dark: hsl(200, 80%, 35%);
  --primary-light: hsl(200, 80%, 70%);
}

Shift the hue by 60° for analogous schemes, or 120° for triadic harmony.

Convert colors instantly

Use the color converter tools to switch between HEX, RGB, HSL, and CMYK in real time. All conversions happen client-side.