Free Color Converter — HEX to RGB, HSL & CMYK

April 2, 2026 · 5 min read · Try the tool →

Whether you're writing CSS, designing in Figma, or preparing files for print, you constantly need to convert between color formats. Our free color converter handles HEX, RGB, HSL, and CMYK — with bonus features like palette generation and WCAG contrast checking.

Color Format Quick Reference

FormatSyntaxExampleBest For
HEX#RRGGBB#FF5733CSS, HTML, design tools
RGBrgb(R, G, B)rgb(255, 87, 51)CSS, JavaScript, screens
HSLhsl(H, S%, L%)hsl(11, 100%, 60%)Color manipulation, theming
CMYKC%, M%, Y%, K%0%, 66%, 80%, 0%Print design, offset printing

HEX to RGB: How the Conversion Works

A HEX color code like #FF5733 is actually three pairs of hexadecimal digits representing Red, Green, and Blue channels:

#FF5733
 ││││││
 ├┤├┤├┤
 R  G  B

FF = 255 (Red)
57 = 87  (Green)
33 = 51  (Blue)

Result: rgb(255, 87, 51)

Shorthand HEX codes like #F53 expand to #FF5533 — each digit doubles.

JavaScript Conversion

// HEX to RGB
function hexToRgb(hex) {
  hex = hex.replace('#', '');
  return {
    r: parseInt(hex.substring(0, 2), 16),
    g: parseInt(hex.substring(2, 4), 16),
    b: parseInt(hex.substring(4, 6), 16)
  };
}

// RGB to HEX
function rgbToHex(r, g, b) {
  return '#' + [r, g, b]
    .map(v => v.toString(16).padStart(2, '0'))
    .join('');
}

Why HSL Is Better for Theming

HSL (Hue, Saturation, Lightness) is more intuitive than RGB for creating color systems:

This means you can create consistent tints and shades by just adjusting the L value:

/* CSS Custom Properties with HSL theming */
:root {
  --hue: 145;         /* Brand green */
  --primary: hsl(var(--hue), 80%, 50%);
  --primary-light: hsl(var(--hue), 80%, 70%);
  --primary-dark: hsl(var(--hue), 80%, 30%);
  --primary-bg: hsl(var(--hue), 80%, 95%);
}

/* Dark mode? Just adjust lightness */
[data-theme="dark"] {
  --primary: hsl(var(--hue), 80%, 60%);
  --primary-bg: hsl(var(--hue), 80%, 10%);
}

CMYK: When You Need Print Colors

CMYK (Cyan, Magenta, Yellow, Key/Black) is used for print. RGB/HEX colors on your screen won't always look the same when printed because screens emit light (additive color) while print absorbs light (subtractive color).

Important: RGB-to-CMYK conversion is approximate without an ICC color profile. Our tool gives you a good starting point, but for production print work, use your design tool's color management system.

WCAG Contrast: Accessibility Matters

The Web Content Accessibility Guidelines (WCAG) define minimum contrast ratios between text and background colors:

LevelNormal TextLarge Text (18px+ bold, 24px+ regular)
AA4.5:13:1
AAA7:14.5:1

Our tool includes a built-in contrast checker — pick your text color and background, and instantly see if your combination passes AA and AAA requirements.

Contrast Ratio Formula

// Relative luminance
function luminance(r, g, b) {
  const [rs, gs, bs] = [r, g, b].map(c => {
    c /= 255;
    return c <= 0.03928
      ? c / 12.92
      : Math.pow((c + 0.055) / 1.055, 2.4);
  });
  return 0.2126 * rs + 0.7152 * gs + 0.0722 * bs;
}

// Contrast ratio
function contrastRatio(l1, l2) {
  const lighter = Math.max(l1, l2);
  const darker = Math.min(l1, l2);
  return (lighter + 0.05) / (darker + 0.05);
}

Color Palette Types Explained

🎨 Try the Color Converter

Convert colors, generate palettes, check contrast — all free, all in your browser.

Open Color Converter →

Turn product updates into launch content

Once the design work is done, use the Content Repurposer to turn release notes, demos, and changelogs into social posts, newsletters, and launch copy. Need automation? The Content Repurposer API handles that workflow.

See the API →

Related Tools