Convert HEX to RGB
Converting hexadecimal (HEX) to Red, Green, Blue (RGB) is a precise, rule-based operation — both formats describe the same color with different numbers. Whether you are tuning a CSS custom property, matching a brand color across design tools, or preparing values for print, this page gives you an interactive converter, the exact HEX → RGB method, a worked example, a quick-reference table and the details that matter (rounding, gamut and print caveats).
From
To
—
—
—
Live preview
How to convert HEX to RGB
Take this real example — the color firebrick(#c2410c):
#c2410c → rgb(194, 65, 12)
- Split the hex code into three two-digit pairs: RR, GG, BB.
- Convert each pair from base 16 to decimal (e.g. C2₁₆ = 12×16 + 2 = 194) to get R, G and B on the 0–255 scale.
- Write them as rgb(R, G, B). To go back, convert each decimal channel to two hex digits and concatenate: #RRGGBB.
R = hex(RR)₁₆ → decimal, and back: channel = round(value), hex(channel) = two base-16 digits
HEX to RGB conversion table
| Color | HEX | RGB |
|---|---|---|
| White | #ffffff | rgb(255, 255, 255) |
| Black | #000000 | rgb(0, 0, 0) |
| Red | #ff0000 | rgb(255, 0, 0) |
| Lime | #00ff00 | rgb(0, 255, 0) |
| Blue | #0000ff | rgb(0, 0, 255) |
| VersatilBox accent | #c2410c | rgb(194, 65, 12) |
| Tailwind blue-500 | #3b82f6 | rgb(59, 130, 246) |
| Tailwind emerald-500 | #10b981 | rgb(16, 185, 129) |
About these formats
HEX (hexadecimal). HEX is the web's native notation: a # followed by two digits per channel in base 16 (00–FF). Compact, unambiguous and supported everywhere, from CSS to design tools.
RGB (Red, Green, Blue). RGB is the additive model screens use: every color is a mix of red, green and blue light from 0 to 255 per channel. It is the numeric base all on-screen conversions pass through.
Frequently asked questions
How do I convert HEX to RGB?
Split the hex code into three two-digit pairs: RR, GG, BB. Convert each pair from base 16 to decimal (e.g. C2₁₆ = 12×16 + 2 = 194) to get R, G and B on the 0–255 scale. Write them as rgb(R, G, B). To go back, convert each decimal channel to two hex digits and concatenate: #RRGGBB. The converter above does it instantly, including the reverse direction.
What is HEX?
HEX — hexadecimal — is the web's native notation: a # followed by two digits per channel in base 16 (00–FF). Compact, unambiguous and supported everywhere, from CSS to design tools.
What is RGB used for?
RGB (Red, Green, Blue) is the additive model screens use: every color is a mix of red, green and blue light from 0 to 255 per channel. It is the numeric base all on-screen conversions pass through.
Is the HEX → RGB conversion exact?
Yes. HEX and RGB encode the identical numbers in different notations, so the conversion is exact in both directions with no rounding.
Why does the RGB value look different in other tools?
Small differences come from rounding (how many decimals are kept) and from out-of-gamut handling. This site follows the CSS Color 4 algorithms and shows OKLCH with 3 decimals, the same convention used by browsers and mainstream design tools.