Convert rgba() colors to hex — including the alpha channel. rgba(30, 144, 255, 0.6) becomes the 8-digit hex #1e90ff99, where the last two digits encode opacity in base 16. The tool accepts legacy and modern rgba syntax and shows the plain 6-digit hex too.
Settings
Generated locally in your browser — your settings and results never leave this page.
Eight digits, four channels
The 8-digit hex notation appends the alpha channel as a fourth base-16 pair: #rrggbbaa. It exists so translucent colors can live wherever hex lives — design tokens, SVG, config files — without switching to functional syntax. This converter parses any rgba() spelling and produces that compact form, plus the solid 6-digit base color when you need it.
The alpha pair follows the same arithmetic as the color pairs: multiply the 0–1 alpha by 255 and write it in hex. That mapping is why the values look unintuitive — 50% is 80, not 50.
Worked example: rgba(255, 99, 71, 0.35)
Tomato at 35% opacity:
0.35 × 255 = 89.25 → 89 → 59₁₆ rgba(255, 99, 71, 0.35) = #ff634759
Going the other way, read the last pair, convert to decimal, divide by 255: 59 → 89 → 0.349… The one-digit-in-255 quantization means alpha survives the round trip to within 0.4% — imperceptible, but the reason 0.35 can come back as 0.349.
| Alpha | 10% | 25% | 50% | 60% | 75% | 90% |
|---|---|---|---|---|---|---|
| Hex pair | 1a | 40 | 80 | 99 | bf | e6 |
Common places this bites
Tailwind arbitrary values (bg-[#ff634759]), SVG fill attributes, and any token pipeline that validates strict hex. Conversely, some older tools (and CSS in email clients) reject 8-digit hex entirely — then the rgba() you pasted in is itself the fallback. The tool keeps both spellings a click apart for exactly these situations.
Limits worth knowing
The 4-digit shorthand #rgba exists but can only express alphas whose pair repeats a digit (#f637 means alpha 77 ≈ 46.7%), so tools emit the full form. And an alpha of exactly 1 drops the pair entirely here — ff adds bytes, not information.
Alpha pairs at a glance
The alpha byte is the part nobody memorizes. A working table of common opacities, their exact hex pairs, and dodger blue carrying each — computed, not copied:
| Opacity | Alpha byte | Hex pair | Example |
|---|---|---|---|
| 10% | 26 | 1a | #1e90ff1a |
| 20% | 51 | 33 | #1e90ff33 |
| 35% | 89 | 59 | #1e90ff59 |
| 50% | 127 | 7f | #1e90ff7f |
| 65% | 166 | a6 | #1e90ffa6 |
| 80% | 204 | cc | #1e90ffcc |
| 95% | 242 | f2 | #1e90fff2 |
The table exposes the non-obvious spellings: 50% is 80, not 50; 20% is 33. Bookmark-worthy pairs are 80 (half), 99 (60% — the classic scrim), and e6 (90% — barely-there transparency). Everything else this page computes on demand.
How to use the RGBA to HEX Converter
- Paste the rgba() color – legacy commas or modern slash syntax both parse.
- The result updates live as you type – no convert button needed.
- Copy the 8-digit hex with alpha, or the plain 6-digit hex if you only need the base color.
- Copy the value with the copy button, or switch the output format dropdown for other export shapes.
Frequently asked questions
How does rgba() map to an 8-digit hex code?
The three channels convert to base-16 pairs as usual, then alpha multiplies by 255 and converts the same way as the fourth pair. rgba(30, 144, 255, 0.6): alpha 0.6 → 153 → 99, giving #1e90ff99.
Which browsers support 8-digit hex colors?
All modern browsers – the #rrggbbaa notation has been Baseline for years, since Chrome 62, Firefox 49 and Safari 10. Legacy concerns only apply to long-dead engines; for those, rgba() itself is the safe fallback.
Why is #1e90ff99 not "99% opaque"?
Because 99 is hexadecimal, not a percentage: 0x99 = 153, and 153/255 ≈ 60%. Full opacity is ff (255). Reading the alpha pair as a percentage is the classic 8-digit-hex misunderstanding.
What is the 4-digit hex shorthand with alpha?
#rgba doubles each digit like #rgb does: #19f9 means #1199ff99. It can only express alphas whose two hex digits repeat, so tools mostly emit the full 8-digit form.
What happens to alpha 1 when I convert?
The tool emits the clean 6-digit hex, because a trailing ff adds bytes without information. You still get the 8-digit form in the outputs if your pipeline demands fixed-width values.
Can I flatten a translucent color into a solid hex?
Blending against a known background does that: for each channel, α×color + (1−α)×background. The Color Mixer performs exactly this computation if you mix your color with the background at the alpha ratio in sRGB.
Does the conversion happen locally?
Yes – parsing and base-16 formatting run entirely in your browser. The color never leaves the page, which also makes the tool work offline once loaded.