Hex to RGB Color Converter

Convert hex color codes to RGB, HSL, and CMYK values instantly. Also converts RGB to hex. Preview colors in real-time and copy CSS-ready code. Free, fast, and private.

Ad Space

How Hex to RGB Conversion Works

A hex color code is a 6-digit hexadecimal representation of a color. The first two digits represent red, the next two green, and the last two blue. Each pair converts to a decimal value between 0 and 255. For example, #FF5733 means Red=255, Green=87, Blue=51. This hex to RGB converter handles both 3-digit shorthand (#F00) and 6-digit (#FF0000) formats.

Conversion Formula

Hex → RGB: #D9FE06 → R:217, G:254, B:6

Each hex pair: D9₁₆ = 13×16 + 9 = 217

RGB → Hex: rgb(255, 87, 51) → #FF5733

Color Models Explained

Different color models serve different purposes. RGB (Red, Green, Blue) is used for screens and digital displays — it's additive, meaning colors are created by combining light. CMYK (Cyan, Magenta, Yellow, Key/Black) is used for printing — it's subtractive, meaning colors are created by absorbing light. HSL (Hue, Saturation, Lightness) is more intuitive for humans to understand and adjust.

Hex Colors in CSS

Web developers use hex color codes extensively in CSS. The format #RRGGBB is the standard, with #RGB as shorthand (e.g., #F00 = #FF0000). Modern CSS also supports rgba() for transparency. When working with design systems, you may need to convert between hex, RGB, and HSL formats — this converter handles all three plus CMYK for print work.

When to Use Each Color Format

Use hex (#RRGGBB) in CSS for clean, compact color codes. Use RGB when you need to programmatically calculate colors or add transparency (rgba). Use HSL when adjusting color variations — changing lightness or saturation is intuitive in HSL. Use CMYK only for print design — web colors should always use RGB-based formats.