Convert 8-digit hex colors with alpha
The #RRGGBBAA syntax lets a single CSS hex value carry an opacity in its final byte. This converter decodes any 8-digit hex into its red, green, blue, and alpha components, gives you the matching rgba() string, and round-trips back to hex. A checkerboard backing behind the swatch makes the transparency visible so you can judge how the color will actually composite.
How it works
The input is normalized first: shorthand #RGB and #RGBA are expanded by doubling each digit, and a 6-digit value gets an ff alpha appended. The three color bytes are parsed as 0–255 integers exactly as in any hex color. The alpha byte is parsed the same way, then divided by 255 to produce the CSS 0–1 alpha used in rgba(). Converting back simply reverses this: the 0–1 alpha is multiplied by 255 and formatted as a two-digit hex byte appended to the color.
Worked example
The value #3b82f6cc decodes as follows:
| Byte pair | Value | Meaning |
|---|---|---|
| 3b | 59 | Red |
| 82 | 130 | Green |
| f6 | 246 | Blue |
| cc | 204 | Alpha → 204 / 255 ≈ 0.800 |
Result: rgba(59, 130, 246, 0.800) — a medium blue at 80% opacity.
Common alpha byte reference
Knowing a few landmarks helps when writing 8-digit hex by hand:
| Alpha byte | Opacity |
|---|---|
| ff | 100% (fully opaque) |
| cc | 80% |
| 99 | 60% |
| 80 | ~50% |
| 66 | 40% |
| 33 | 20% |
| 00 | 0% (invisible) |
Channel order pitfall — CSS vs Android
CSS and the web use alpha-last order: #RRGGBBAA. Android and several other
platforms use alpha-first order: #AARRGGBB. If you copy a color value from
Android XML resources or a Kotlin/Java source file, the channels will be in the
wrong order here unless you swap the first two bytes with the last two.
For example, Android’s #CC3B82F6 (alpha CC, blue 3b82f6) should be entered
as #3B82F6CC in CSS tools like this one.
When to use the alpha-stripped output
The converter also shows the 6-digit hex without alpha, which is useful as a
fallback for contexts that do not support 8-digit syntax. For instance, some
SVG renderers and older email clients do not understand #RRGGBBAA, so a
degradation strategy is to specify the solid 6-digit color first and layer
transparency via opacity or a separate attribute.
Browser support for 8-digit hex
The #RRGGBBAA syntax was added in the CSS Color Level 4 specification.
Support is broad across modern browsers, but the 4-digit shorthand #RGBA and
8-digit #RRGGBBAA are not understood in:
- Internet Explorer (all versions)
- Some older versions of Safari (pre-2020)
- Certain SVG tooling that has not been updated to Color Level 4
For general web use today, 8-digit hex is safe in modern browsers. For maximum
compatibility when targeting legacy environments, use rgba() instead, which
has been supported far longer and is what this tool also outputs.
Everything runs in your browser — nothing is uploaded.