Advertisements

headerup to 320x100 / 728x90

HEX to RGB

Convert HEX color to RGB

HEX to RGB

Paste a HEX color and inspect synchronized derived formats.

Working color
Use a color-aware form instead of a generic input/output template.
Swatch
Result
The tool-specific output stays visible together with derived color formats.
Waiting for a valid color value...
HEX
#4F46E5
RGB
rgb(79, 70, 229)
HSL
hsl(243, 75%, 59%)
HSV
hsv(243, 69%, 90%)
CMYK
cmyk(66%, 69%, 0%, 10%)
OKLCH
Unavailable
Palette preview
Advertisements

content bottomup to 300x250

What is HEX to RGB

Last reviewed:

Hexadecimal (base 16) uses digits 0-9 and letters A-F to represent bytes compactly, widely used for colors, hashes, and low-level binary data.

HEX to RGB Converter parses a hexadecimal color literal (#RGB, #RRGGBB, or #RRGGBBAA) and returns the equivalent rgb() or rgba() triple in the 0–255 integer range that CSS, design software, and graphics APIs expect.

Shorthand 3-digit hex like #fb0 is expanded to #ffbb00 before conversion; 8-digit hex preserves the alpha channel and emits rgba() with the matching 0-1 floating-point alpha.

Why use it

  • Convert hex values from Figma, Tailwind, or a brand style guide into the rgb()/rgba() CSS syntax that animation libraries and gradient functions require.
  • Inspect the exact red, green, and blue channel values for accessibility checks (contrast ratios, WCAG AA/AAA thresholds).
  • Debug color drift between a design file (hex) and a runtime CSS variable (rgb triple).

Features

  • Accepts 3-, 6-, and 8-digit hex codes with or without the leading #
  • Emits both `rgb(r, g, b)` and the space-separated `rgb(r g b)` modern syntax
  • Preserves alpha from 8-digit hex (#RRGGBBAA) as rgba() with 2-decimal alpha
  • Batch mode: paste multiple hex values (one per line) for bulk conversion
  • Shows the RGB decimal values plus the 0–1 normalized floats used by WebGL and Canvas APIs

How to use HEX to RGB

  1. Paste a hex color. Type or paste a hex value like #ff8040 or #fb0. The leading # is optional; 3-digit shorthand is accepted.
  2. Check the parsed output. The RGB result updates live as you type, with a color swatch so you can verify visually.
  3. Copy the rgb() string. Click the copy button on the RGB output field — the tool copies rgb(255, 128, 64) ready to paste into your CSS.
  4. Batch-convert multiple values. Click 'Batch mode' to paste a newline-separated list of hex codes; the tool returns one rgb() line per input.

Example (before/after)

HEX input

Paste your HEX input so it can be converted into RGB for your next step.

RGB output

Get RGB output converted from HEX that is ready to review, copy, or export into the next step of your workflow.

Common errors

Source format does not match the tool

Conversions fail when the pasted input is not actually in the expected source format.

Fix: Verify the source format first, then paste it into the correct converter.

Partial or inconsistent data

Broken rows, missing fields, or incomplete markup can block conversion.

Fix: Use a complete input sample with the structure intact before converting it.

Unexpected output assumptions

Different target formats can flatten, restructure, or serialize values differently.

Fix: Review the converted output and confirm it matches the target system before using it downstream.

FAQ

Does HEX to RGB handle 3-digit shorthand like #f80?

Yes. 3-digit shorthand hex is expanded to its 6-digit equivalent before conversion (#f80 → #ff8800), matching the rule used by CSS and Sass. The expanded value is shown in the output so you can verify.

Can the converter preserve the alpha channel from 8-digit hex?

Yes. 8-digit hex (#RRGGBBAA) includes an alpha byte; the converter maps that byte to an rgba() alpha between 0 and 1 rounded to 2 decimals. For example, #ff804080 becomes rgba(255, 128, 64, 0.5).

What's the difference between rgb(255, 128, 64) and rgb(255 128 64)?

They're semantically identical — both describe the same color. The comma-separated form is the legacy CSS syntax; the space-separated form is the modern one introduced in CSS Color Module Level 4. The tool emits both so you can pick whichever matches your project's style guide.

Why does my hex look slightly different when converted to rgb?

It shouldn't — hex and rgb are two notations for the same sRGB color space, so the mapping is exact and lossless. Visual drift usually means the surrounding context (transparency, blending mode, or an ICC profile) is different, not the color math.

Can I convert a named CSS color (like 'tomato') to RGB with this tool?

Indirectly. Named colors first resolve to a hex value via the CSS Color Module lookup table — use our Named Color to HEX tool to go from 'tomato' to #ff6347, then feed that into the HEX to RGB converter.

Does the converter work for wide-gamut (P3, Rec.2020) hex values?

The standard hex format describes only sRGB colors, so there's no ambiguity. For wide-gamut color, you'd use the CSS color() function with explicit color-space syntax rather than hex — our OKLCH and color-mix tools cover those cases.