Convert hex to RGB (and back)
On the default, #2563eb → rgb(37, 99, 235) — a medium blue with relative luminance 0.16, so white text wins. Paste your own color below.
FREE TOOL · MATH
Paste any hex color — #2563eb, #f53, even 8-digit #2563ebcc with alpha — and get the RGB triplet, ready-to-paste CSS, a luminance verdict for text color, and the actual color on a swatch. Works in reverse too.
On the default, #2563eb → rgb(37, 99, 235) — a medium blue with relative luminance 0.16, so white text wins. Paste your own color below.
A hex color is three two-digit hexadecimal numbers glued together: #RRGGBB. Each pair runs from 00 (none) to FF (full) — that is 0 to 255 in decimal, or 256 levels per channel. So #2563eb means red 2516 = 37, green 6316 = 99, blue eb16 = 235. Three channels × 256 levels = 16,777,216 possible colors — every color your screen can show lives in this scheme. The 3-digit shorthand just doubles each digit: #f53 = #ff5533. And an optional fourth pair sets alpha (transparency): #2563eb80 is the same blue at 50% opacity.
| Output | Formula | What it means |
|---|---|---|
| RGB triplet | each hex pair → decimal | #2563eb → rgb(37, 99, 235). |
| CSS snippet | rgb() or rgba() with alpha | copy-paste ready for stylesheets. |
| Relative luminance | 0.2126R + 0.7152G + 0.0722B (linearized) | 0.16 for the default — a dark color. |
| Text-color verdict | contrast ≥ 4.5:1 vs white or black | white text wins on the default blue. |
The fastest mental read: #ffffff is all three channels maxed → white; #000000 is all off → black. Equal pairs make grays: #808080 is mid-gray (128 each). One channel maxed alone gives the primaries: #ff0000 red, #00ff00 green, #0000ff blue. Everything else is a mix — and the converter decodes any mix instantly.
They describe the same colors — the choice is workflow. HEX is shorter and dominates design files, brand guides, and copy-paste from pickers. rgb() is friendlier when you compute colors in code (animations, canvas, theming with CSS variables) and mandatory when you need alpha in old browsers: rgba(37, 99, 235, 0.5) is clearer than #2563eb80 to a human reader. Modern CSS also accepts the 8-digit hex — both are fine, so use whichever your team reads faster.
Conversions are exact integer arithmetic between base-16 and base-10 — 256 levels per channel, no rounding. Luminance uses the WCAG relative-luminance formula with sRGB linearization; the text verdict checks the 4.5:1 WCAG AA threshold. Displayed colors assume sRGB, which matches virtually all consumer screens; wide-gamut (Display P3) screens may render slightly more vividly.
More base conversions: the binary, hex & decimal chart covers 0–255 in every base, and the significant figures calculator handles precision in the decimal world.
Bright Side Kit. "Hex to RGB Converter with Live Preview." https://brightoolbox.com/hex-to-rgb-converter/ Accessed October 22, 2026.rgb(37, 99, 235) — red 37, green 99, blue 235. Paste it into the converter above for the CSS snippet and a luminance verdict.
Full intensity. Each channel runs 00 (off) to FF (full, = 255). So #ff0000 is pure red, #00ff00 pure green, #ffffff white, #000000 black.
Expand the shorthand: #fff → #ffffff → rgb(255, 255, 255) — white. Each doubled digit: f→ff = 255.
It adds an alpha (transparency) pair: #RRGGBBAA. #2563eb80 is the blue at 50% opacity (8016 = 128 ≈ half of 255). Omit it and alpha is 1 — fully opaque.
They are identical colors. HEX is shorter (great for brand specs); rgb()/rgba() is clearer when alpha or computed values are involved. Use whichever your team reads faster.
Check contrast. The converter computes relative luminance and tests both against the WCAG AA 4.5:1 bar — on the default blue, white wins. Luminance below ~0.18 usually means white text; above ~0.35, black.
Screens emit light (additive RGB); printers lay down ink (subtractive CMYK). Neon and deep blues shift the most. Convert with your printer's profile or pick from a printed swatch book for exact matches.