Design files speak hexadecimal, JavaScript and canvas APIs speak decimal, and the gap between the two is where small mistakes happen — a channel read as 52 instead of 219 produces a color nobody asked for. This tool converts hex color codes to RGB values instantly: type or paste a hex code, and the red, green, and blue channel values appear live alongside the CSS rgb() string and a swatch of the exact color, all computed in your browser with nothing sent anywhere.
The page is deliberately narrow. Where a general color converter juggles four notations, this one does one job thoroughly: it parses messy real-world input (with or without the hash, in upper or lower case), expands three-digit shorthand automatically, reads the eight-digit RGBA form that includes transparency, and explains the arithmetic so you can verify any conversion by hand afterward. If you work with web colors often, understanding this one mapping — hex pairs to decimal channels — demystifies most of what follows in color handling.
What Hex and RGB Actually Represent
A six-digit hex code is three bytes written in hexadecimal: the first pair is the red channel, the second green, the third blue. RGB is the same three numbers in decimal, each from 0 to 255. Both notations describe identical values — 8 bits per channel, 24 bits total, roughly 16.77 million possible colors, which is what the phrase 24-bit color or truecolor means.
A worked example ties them together. Take #1A2B3C: the red byte is 1A, and 1A in hex means 1 times 16 plus A times 1, where A stands for 10 — giving 26. The green byte 2B is 2 times 16 plus 11, giving 43. The blue byte 3C is 3 times 16 plus 12, giving 60. So #1A2B3C converts to rgb(26, 43, 60), a very dark navy. Reverse-checking is fast: 43 divided by 16 is 2 remainder 11, and 11 in hex is B, hence 2B.
How to Use This Tool (Step by Step)
- Paste or type the hex code into the input. The hash is optional — the tool accepts 1A2B3C and #1A2B3C identically, and case never matters.
- Read the three channel values and the ready-to-paste rgb() string from the result panel.
- Check the swatch to confirm the parsed color is the one you intended — a caught misparse costs nothing, a deployed one does not.
- Try the three-digit shorthand form, like #F53, which expands to FF5533 before conversion.
- For transparency, paste an eight-digit code such as #FF573380; the final pair is reported separately as the alpha value, 80 hex being 128 decimal, or 50 percent opacity.
Three-Digit Shorthand and How Expansion Works
CSS allows a compact form where each digit is doubled: #F53 becomes #FF5533. The rule is mechanical repetition — the red digit F becomes FF, the green 5 becomes 55, the blue 3 becomes 33. That yields rgb(255, 85, 51), a strong coral red. Shorthand only expresses colors whose two hex digits per channel are identical, which is 4,096 of the 16.77 million colors — but those include the everyday workhorses like #000, #FFF, and #333, which is why minifiers and hand-written CSS lean on it. The expansion is lossless: a color written short-form converts to exactly the same RGB as its long form.
The Eight-Digit Form: Hex With Alpha
The modern CSS spec extends hex to four pairs, the last describing opacity. Each step of alpha halves or doubles actual visibility in the same binary way channels do — and the mapping is linear, so 80 hex is exactly 128 decimal, half opacity, while 40 hex is 64 decimal, a quarter opacity, and FF is fully opaque. This tool reports the alpha channel separately so the RGB conversion stays clean: #FF573380 reads as the same coral color at half opacity. Older tooling that predates the syntax will reject eight-digit codes outright, so check what your destination accepts before standardizing on the form.
Conversion Examples You Can Verify by Hand
| Hex | Red | Green | Blue | rgb() string |
|---|---|---|---|---|
| #FF5733 | 255 | 87 | 51 | rgb(255, 87, 51) |
| #1A2B3C | 26 | 43 | 60 | rgb(26, 43, 60) |
| #7F7F7F | 127 | 127 | 127 | rgb(127, 127, 127) |
| #F53 (expands to FF5533) | 255 | 85 | 51 | rgb(255, 85, 51) |
| #FFFFFF | 255 | 255 | 255 | rgb(255, 255, 255) |
| #000000 | 0 | 0 | 0 | rgb(0, 0, 0) |
The gray row is worth a second look: 7F hex is 127 decimal, one below half brightness — the nearest a byte gets to 50 percent. That off-by-one appears constantly in gradients and is a classic source of why the middle stop of a CSS gradient does not look exactly half-way between its endpoints.
Where Hex-to-RGB Conversion Goes Wrong
- Five-digit input: neither shorthand nor long form — almost always a lost character in transit. The tool flags the length rather than guessing.
- Non-hex characters: letters beyond F, stray quotes from copying out of a stylesheet, or a colon riding along from JSON. The parser names the offending character.
- Percent confusion: rgb can legally be written with percentages — rgb(100%, 50%, 0%) — but hex cannot; there is no percent form of a hex pair, and mixing the mental models produces values like 100 in a channel where 255 was meant.
- Wrong pair boundaries: reading 1A2B3C as channels 1A2, B3C is a common beginner slip; the format is strictly two digits per channel.
- Alpha misread as blue: pasting an 8-digit code into a converter that only reads 6 digits yields a wrong blue channel from the alpha pair — this tool separates the last pair out instead.
Practical Uses in Daily Work
Several routine tasks reduce to this conversion. Reading a color out of a design export and applying it in JavaScript — canvas fill styles, WebGL uniforms, chart libraries — needs decimal channels. Computing color math like blending, darkening, or contrast ratios operates on numeric channels, not text. Debugging a rendering mismatch between a mockup and a live page starts by converting both sides to the same notation and comparing channel by channel. And accessibility work converts colors to RGB first because the WCAG contrast formula consumes linearized channel values. In each case the swatch closes the loop: convert, glance, confirm.
Tips and Best Practices
- Keep brand colors in hex as the single source of truth and convert to RGB at the point of use, rather than maintaining parallel definitions.
- Use the swatch as a parse check every time — especially after pasting from documents where invisible characters sneak in.
- Remember 00 is black-channel-off and FF is full-on; mentally anchoring those two makes any hex code readable at a glance.
- For opacity in CSS, prefer rgba() or 8-digit hex consistently, and know that 80 is the exact midpoint value.
- The conversion is pure math running locally — colors from unreleased designs can be checked here without leaving your machine.