Click to pick
Color value HEX

Supports: #HEX, rgb(), rgba(), hsl(), hsla(), hsv(), cmyk(), hwb(), CSS color names (e.g. coral)

Unrecognized color format. Try #FF5733 or rgb(255, 87, 51).
Presets:
HEX (6-digit)
#3B5BFD
Standard CSS & HTML hex code
HEX (3-digit)
Not reducible
Shorthand (only when each channel is divisible by 17)
HEX + Alpha (8-digit)
#3B5BFDFF
CSS Color Level 4 — last two digits are alpha (FF = 100%)
RGB
rgb(59, 91, 253)
Red · Green · Blue — each channel 0–255
RGBA
rgba(59, 91, 253, 1)
RGB + alpha transparency (0–1)
HSL
hsl(232, 97%, 61%)
Hue (0–360°) · Saturation · Lightness
HSLA
hsla(232, 97%, 61%, 1)
HSL + alpha transparency (0–1)
HSV / HSB
hsv(232°, 77%, 99%)
Hue · Saturation · Value (Brightness) — used in Photoshop & Figma
CMYK
cmyk(77%, 64%, 0%, 1%)
Cyan · Magenta · Yellow · Key (Black) — print standard
HWB
hwb(232 23% 1%)
Hue · Whiteness · Blackness — CSS Color Level 4
CSS Color Name
— (no exact match)
Exact CSS named color if it matches (e.g. coral)
Decimal (integer)
3889149
24-bit RGB integer — used in some APIs and game engines

Complete Guide to Color Formats & Conversion

Color is everywhere in digital design — from websites and mobile apps to print materials and data visualization. But different tools and platforms speak different color languages. A color that looks perfect in Photoshop might need conversion before it works in CSS. This guide explains every major color format, when to use each one, and how to convert between them like a pro.

What Is a Color Space?

A color space is a mathematical model that describes how colors can be represented as numbers. Different color spaces are optimized for different purposes:

  • RGB (Red, Green, Blue) — Additive color model used for screens. Light is added to create color.
  • CMYK (Cyan, Magenta, Yellow, Key/Black) — Subtractive color model used for printing. Ink is subtracted from white paper.
  • HSL / HSV — Perceptual models that separate color into hue (the actual color), saturation (intensity), and lightness/value (brightness).
  • HWB (Hue, Whiteness, Blackness) — A newer CSS model that mimics how artists mix paint.

Most digital design workflows start in RGB (because monitors are RGB), then convert to CMYK for print or HSL/HSV for human-friendly adjustments.

Color Format Reference

Every major design tool, browser, and programming language has a preferred color format. Here's a quick overview — full details follow below.

HEX
#FF5733
Universal web standard. 6 hex digits — 2 per channel. Shorthand #F57 works when both digits in each pair are identical. Add 2 more digits for alpha.
RGB / RGBA
rgb(255, 87, 51)
CSS and JavaScript standard. Channels 0–255. RGBA adds an alpha channel (0 = transparent, 1 = opaque). Easiest to reason about in code.
HSL / HSLA
hsl(11, 100%, 60%)
Most human-friendly CSS format. Adjust hue (color wheel 0–360°), saturation (vividness), and lightness independently. Best for palette generation.
HSV / HSB
hsv(11°, 80%, 100%)
Used in Photoshop, Figma, and most design apps. Value (V) at 100% = pure bright color; reducing it adds black. Not a native CSS format.
CMYK
cmyk(0%, 66%, 80%, 0%)
Print standard — Cyan, Magenta, Yellow, Key (Black). Subtractive color model. Screen-to-print values are approximate; exact results depend on printer ICC profile.
HWB
hwb(11 0% 0%)
CSS Color Level 4. Mix a pure hue with white or black like paint. Supported in all modern browsers. Intuitive for tint/shade variations.
HEX 8-digit
#FF5733CC
CSS Color Level 4. Last two hex digits = alpha channel (00 = transparent, FF = opaque). Useful in modern design tokens and CSS variables.
CSS Named Color
coral
148 predefined CSS color names from black to rebeccapurple. Only works for exact HEX matches — most custom colors won't have a name.

Detailed Breakdown of Every Color Format

HEX (Hexadecimal)

Syntax: #RRGGBB or #RGB (shorthand) or #RRGGBBAA (with alpha)

HEX is the most common format in web development. It represents red, green, and blue as two-digit hexadecimal numbers (00 to FF). For example, #FF5733 means red = 255, green = 87, blue = 51.

When to use HEX: CSS and HTML styling (most compact format), design tools (Figma, Sketch, Adobe XD), color variables in design systems.

HEX shorthand (#F57) works only when each pair of digits is identical (#FF5577#F57). HEX with alpha (#FF5733CC) was introduced in CSS Color Level 4 — the last two digits represent opacity: FF = fully opaque, 00 = fully transparent.

RGB & RGBA

Syntax: rgb(red, green, blue) or rgba(red, green, blue, alpha)

Each channel is an integer from 0 to 255. rgb(255, 87, 51) is identical to #FF5733. RGBA adds an alpha channel as a decimal between 0 and 1 — for example, rgba(255, 87, 51, 0.5) for 50% opacity.

When to use: JavaScript color manipulation (easier than parsing HEX), CSS gradients and dynamic styling, APIs that return colors as integers. Modern CSS also supports rgb(255 87 51 / 0.5) (space-separated with slash for alpha).

HSL & HSLA

Syntax: hsl(hue, saturation%, lightness%)

HSL is the most human-friendly color model for CSS. Three intuitive components: Hue (0–360° on the color wheel: 0° = red, 120° = green, 240° = blue), Saturation (0–100% purity: 0% = gray, 100% = vivid), and Lightness (0–100%: 0% = black, 50% = pure color, 100% = white).

When to use: Generating color palettes (same hue, different lightness), creating accessible contrasts, CSS animations (animating hue is smooth and predictable). To create a darker version of hsl(11, 100%, 60%), just reduce lightness — no RGB math needed.

HSV / HSB (Hue, Saturation, Value)

Syntax: hsv(hue°, saturation%, value%)

HSV is designed for human color picking. Value (V) = 100% gives the pure, fully bright color. Reducing Value adds black; reducing Saturation adds white (pastel effect). When you pick a color in Photoshop's color picker, you are using HSV.

When to use: Photoshop, GIMP, Affinity Photo (they call it HSB), color picker UI components, image processing algorithms. For the same RGB color, HSL and HSV produce different saturation and lightness/value numbers — both are mathematically correct, just different models.

CMYK (Cyan, Magenta, Yellow, Key/Black)

Syntax: cmyk(cyan%, magenta%, yellow%, key%)

CMYK is the print standard. It is a subtractive model: you start with white paper and subtract light by adding ink. 0% of all inks = white paper. 100% of all inks = muddy black (so black ink "Key" is added separately).

When to use: Commercial printing (brochures, business cards, packaging), print-safe color conversion, Adobe InDesign and Illustrator.

Important: Screen-to-CMYK conversion is always an approximation. Exact printed colors depend on your printer, paper stock, and ICC profile. Always request a physical proof for critical print jobs. Formula: K = 1 − max(R,G,B); C = (1−R−K)/(1−K); M = (1−G−K)/(1−K); Y = (1−B−K)/(1−K).

HWB (Hue, Whiteness, Blackness)

Syntax: hwb(hue whiteness% blackness%)

HWB is a CSS Color Level 4 format — even more intuitive than HSL. You pick a hue, then mix in white and black like paint. hwb(11 0% 0%) = pure hue; hwb(11 50% 0%) = add 50% white (pastel); hwb(11 0% 50%) = add 50% black (darkened). Supported in all modern browsers (Chrome, Edge, Firefox, Safari) since 2023.

Decimal (Integer) RGB

This format packs red, green, and blue into a single 24-bit integer:

Decimal = (R × 65536) + (G × 256) + B
Example: rgb(59, 91, 253) → (59×65536) + (91×256) + 253 = 3,889,149

Used in game engines (Unity, Unreal), low-level graphics programming, and database storage schemes (one integer column instead of three).

Supported Input Formats

This converter auto-detects any of the following input formats as you type:

  • #RGB — 3-digit hex
  • #RRGGBB — 6-digit hex
  • #RRGGBBAA — 8-digit hex
  • rgb(r, g, b)
  • rgba(r, g, b, a)
  • hsl(h, s%, l%)
  • hsla(h, s%, l%, a)
  • hsv(h, s%, v%)
  • cmyk(c%, m%, y%, k%)
  • hwb(h w% b%)
  • CSS color names (e.g. coral)
  • Decimal integer (e.g. 16744448)

Practical Conversion Examples

JavaScript: HEX to RGB

function hexToRgb(hex) {
  const h = hex.replace('#', '');
  const r = parseInt(h.slice(0,2), 16);
  const g = parseInt(h.slice(2,4), 16);
  const b = parseInt(h.slice(4,6), 16);
  return `rgb(${r}, ${g}, ${b})`;
}
hexToRgb('#FF5733'); // returns "rgb(255, 87, 51)"

JavaScript: Lighten Any Color Using HSL

function lighten(hex, percent) {
  const { h, s, l } = rgbToHsl(...hexToRgbArray(hex));
  const newL = Math.min(100, l + percent);
  return `hsl(${h}, ${s}%, ${newL}%)`;
}
lighten('#3B5BFD', 20); // increases lightness by 20%

Python: CMYK to RGB

def cmyk_to_rgb(c, m, y, k):
    r = 255 * (1 - c/100) * (1 - k/100)
    g = 255 * (1 - m/100) * (1 - k/100)
    b = 255 * (1 - y/100) * (1 - k/100)
    return (round(r), round(g), round(b))

print(cmyk_to_rgb(77, 64, 0, 1))  # output: (59, 91, 253)

CSS: Building an Accessible Palette with HSL Variables

:root {
  --primary-hue: 232; /* CalcMeter blue */
  --primary:       hsl(var(--primary-hue), 97%, 61%);
  --primary-light: hsl(var(--primary-hue), 90%, 75%);
  --primary-dark:  hsl(var(--primary-hue), 85%, 45%);
  --primary-muted: hsl(var(--primary-hue), 50%, 70%);
}

This single-hue system ensures all color variations harmonize perfectly — change one variable to rebrand everything.

Pro Tips for Designers & Developers

  1. Use HSL for color palettes — Changing lightness or saturation while keeping hue constant creates harmonious variations automatically.
  2. Store colors as HSL in JavaScript — Manipulating colors (darken, lighten, desaturate) becomes trivial math instead of hex parsing.
  3. Convert CMYK to RGB only for screen preview — Never send CMYK values directly to CSS. Always convert to RGB, HEX, or HSL first.
  4. Test color contrast early — Light gray text on white is beautiful but inaccessible. Use hsl(0, 0%, 30%) instead of #ccc for better WCAG contrast.
  5. Use CSS custom properties — Define colors as --color-primary: #3B5BFD; then reuse them everywhere. Change one line to rebrand your entire site.
  6. Prefer RGBA/HSLA over opacityopacity affects the whole element and its children. RGBA/HSLA only affects the specific background or text color.
  7. Learn the color wheel — Complementary colors (hue ± 180°) create high contrast. Analogous colors (hue ± 30°) create harmony.
  8. Use this converter for design handoff — When a designer gives you hsv(232, 77%, 99%) from Figma, paste it here to get the exact HEX for CSS.

Which Format Should You Use?

Use Case Recommended Format
HTML/CSS stylingHEX or HSL
JavaScript color manipulationRGB or HSL (as objects)
Print designCMYK
Design tool handoff (Figma/Photoshop)HSV / HSB
CSS animationsHSL (smooth hue transitions)
Data URIs / inline imagesHEX (compact)
APIs & databasesDecimal integer or HEX
Accessibility (contrast)RGB or HSL (to calculate luminance)

No single format is "best" — each exists to solve a specific problem. This converter gives you all of them instantly so you can focus on designing, not calculating.

Frequently Asked Questions

Why do my printed colors look different from what I see on screen?

Screens use RGB (additive color, glowing pixels), while printers use CMYK (subtractive color, ink on paper). The RGB color gamut is larger than CMYK — some bright screen colors like neon green cannot be reproduced in print. Use a CMYK-aware design workflow and always request printed proofs for critical jobs.

What is the difference between HSL and HSV? When should I use each?

Both share hue and saturation but handle brightness differently. HSL uses lightness (0% = black, 100% = white) and is used in CSS. HSV uses value (0% = black, 100% = pure color) and is used in design apps like Photoshop. For web development, use HSL. For replicating designs from Figma or Photoshop, use HSV/HSB.

Can I convert any color to CMYK and back without losing data?

No. The conversion is lossy because CMYK has a smaller color gamut than RGB. Some RGB colors have no exact CMYK equivalent. The converter provides the closest possible approximation. For critical print work, always start in CMYK mode in your design software rather than converting from screen colors.

What is color gamut and why does it matter?

Gamut is the range of colors a device or color space can represent. sRGB (standard RGB) is the web standard. Adobe RGB has a wider gamut (more greens and cyans). Display P3 (used by Apple) is even wider. Most browsers assume sRGB unless you use CSS color gamut queries like @media (color-gamut: p3).

How do I make a color transparent in CSS?

Use any format with an alpha channel: rgba(59, 91, 253, 0.5) for 50% opacity, hsla(232, 97%, 61%, 0.3), or #3B5BFD80 (HEX with alpha: 80 hex = 128/255 ≈ 50% opacity). The opacity property works too, but affects the element and all its children — RGBA/HSLA only affects the specific color.

What is the 216-web-safe color palette? Do I still need it?

In the 1990s, many monitors only displayed 256 colors. The 216 "web-safe" colors were guaranteed to dither correctly on those screens. Today virtually all devices display millions of colors (24-bit or higher). You can safely ignore web-safe palettes unless targeting extremely old or embedded hardware.

How does color contrast accessibility work?

WCAG (Web Content Accessibility Guidelines) requires a contrast ratio of at least 4.5:1 for normal text and 3:1 for large text. Copy the RGB or HSL values from this tool into a dedicated contrast checker. The luminance formula is: L = 0.2126×R + 0.7152×G + 0.0722×B (after gamma correction).

Why does this tool show different HSL values than Photoshop?

Photoshop uses HSV/HSB, not HSL. For the same RGB color, HSL lightness = average of min and max RGB channels; HSV value = max RGB channel. Both are mathematically correct — they are just different models. Use the HSV output from this tool to match Photoshop values exactly.

Can I use this converter offline?

Yes. After the page loads once, you can disconnect from the internet. All conversion logic runs locally in your browser using JavaScript. No color data is ever sent to any server.

What does the alpha channel do in RGBA, HSLA, or 8-digit HEX?

Alpha controls transparency: 0 = fully invisible, 1 (or FF in HEX) = fully opaque. Values between create semitransparent colors, useful for overlays, shadows, and layered designs. Alpha blending only affects the specific color property, not the entire element and its children as opacity does.

Which color format is smallest for CSS file size?

HEX shorthand (#F57) is the smallest at 4 characters. Standard HEX (#FF5577) is 7 characters. RGB and HSL are larger. For heavily optimized CSS, use HEX shorthand where possible. Modern gzip compression makes the size difference negligible for most projects.

How do color profiles (ICC) affect conversion accuracy?

ICC profiles define exactly how RGB values map to real-world colors. This converter assumes the standard sRGB color space. If you work with Adobe RGB or Display P3, numeric conversions remain the same but the actual displayed color may differ across devices. Most web content should use sRGB for consistency.


Related Developer & Utility Tools

More free tools to speed up your workflow — all run locally in your browser.