This tool runs entirely in your browser. Nothing you paste is uploaded.
How you can check →HEX to RGB converter
Converts HEX to RGB, entirely in your browser, with the same round-trip receipt the full color converter shows.
Hex to RGB looks trivial — split six hex digits into three pairs, convert each pair from base 16 to base 10 — and mostly it is, except for one shorthand rule a surprising number of tools get wrong. The 3-digit shorthand #f00 doesn't pad with zeros to become #f00000; each digit is duplicated, so #f00 expands to #ff0000, which this converter confirms directly: parsing #f00 and printing it back as rgb() gives rgb(255 0 0), not the darker rgb(240 0 0) a zero-padding parser would produce. The same duplication rule applies to the 4-digit shorthand with alpha.
8-digit hex (#rrggbbaa) and its 4-digit shorthand carry an alpha channel as the last one or two digits — a detail plenty of RGB converters silently drop. Measured directly: #f008 (a 4-digit hex with alpha) expands to rgb(255 0 0 / 0.533), not rgb(255 0 0) with the transparency quietly discarded. Alpha isn't a footnote here — it changes what the color actually looks like once composited against whatever's behind it.
A worked example: #3b82f6 converts to rgb(59 130 246) exactly — every channel of a 6-digit hex value maps to RGB with zero loss in either direction, because hex is just RGB written in base 16 instead of base 10. There's no rounding, no gamut question, and no precision to search for the way there is converting to HSL or OKLCH; this is one of the few conversion pairs on this page where the round trip is unconditionally exact for every input.
Case doesn't matter (#3B82F6 and #3b82f6 are identical), and CSS accepts hex both with and without the leading #, though the # is the conventional and more portable form. Named CSS colors like rebeccapurple (which converts to exactly #663399) or cornflowerblue are a separate lookup table entirely, not a hex shorthand — this page's converter also recognizes them as valid input even though they're not hex syntax at all.
RGB and hex describe the exact same sRGB color space in two different notations, so the choice between them in your CSS is purely stylistic or tooling-driven — rgb() is easier to generate or interpolate programmatically (especially with alpha), while hex is more compact and is what most design tools export by default.
Frequently asked questions
- Does #f00 expand to #f00000 or #ff0000?
- #ff0000. The 3-digit hex shorthand duplicates each digit rather than padding with zeros — #f00 means "ff, 00, 00" for red, green and blue, not "f0, 00, 00". This is a common source of bugs in hand-rolled hex parsers.
- Does this converter handle hex colors with alpha?
- Yes — 4-digit (#rgba) and 8-digit (#rrggbbaa) hex both carry an alpha channel as their last digit(s), and the RGB output includes it as rgb(r g b / a) rather than silently dropping it, which some converters do.
- Is hex to RGB conversion ever lossy?
- No — hex and RGB describe the exact same values in different number bases (base 16 versus base 10), so the conversion between them is always exact in both directions, unlike converting to HSL or OKLCH where the printed decimal precision can affect whether the round trip is exact.