Six-digit hex has no room for transparency. CSS Color Level 4 added 4 and 8-digit hex, where the last digits are the alpha channel (W3C CSS Color 4). Use the table below, or drag the opacity slider in our hex to RGB converter to get the exact code.
How does alpha in hex work?
Alpha works like the other channels: 00 to FF, or 0 to 255. To get the hex for an opacity, multiply the percentage by 255, round it, and convert to hex. 50% is 0.5 × 255 = 127.5, which rounds to 128, which is 80 in hex. That is why 50% is 80, not 50.
Opacity to hex alpha table
| Opacity | Alpha hex | Example with #EF466F |
|---|---|---|
| 100% | FF | #EF466FFF |
| 95% | F2 | #EF466FF2 |
| 90% | E6 | #EF466FE6 |
| 85% | D9 | #EF466FD9 |
| 80% | CC | #EF466FCC |
| 75% | BF | #EF466FBF |
| 70% | B2 | #EF466FB2 |
| 65% | A6 | #EF466FA6 |
| 60% | 99 | #EF466F99 |
| 55% | 8C | #EF466F8C |
| 50% | 80 | #EF466F80 |
| 45% | 73 | #EF466F73 |
| 40% | 66 | #EF466F66 |
| 35% | 59 | #EF466F59 |
| 30% | 4C | #EF466F4C |
| 25% | 40 | #EF466F40 |
| 20% | 33 | #EF466F33 |
| 15% | 26 | #EF466F26 |
| 10% | 1A | #EF466F1A |
| 5% | 0D | #EF466F0D |
| 0% | 00 | #EF466F00 |
Values are rounded to the nearest whole number out of 255, so they can differ by one from tables that round down.
What about 4-digit hex?
Just like #FFF is short for #FFFFFF, #F468 is short for #FF446688. Each digit is doubled, including the alpha one. It only works when every pair is doubled.
Should I use 8-digit hex or rgba()?
They are equivalent, so choose what your team reads more easily:
- 8-digit hex keeps everything in one familiar code, which is handy in design tokens and Figma, which shows hex plus an opacity percentage.
rgba()orrgb(… / 50%)makes the opacity readable at a glance, which is nicer in CSS you edit by hand.
Both are supported in all current major browsers; MDN tracks the details on its hex-color page.
Watch out: Android puts alpha first
Android and Jetpack Compose write colours as 0xAARRGGBB, with alpha at the start. So the same 50% pink is #EF466F80 in CSS but Color(0x80EF466F) in Compose. Swapping them gives you a completely different colour. Our converter shows both formats side by side.
Colour alpha vs the CSS opacity property
An alpha colour makes only that colour see-through, such as a background. The opacity property makes the whole element and everything in it see-through, including text. For a tinted overlay behind readable text, use an alpha colour. Check readability of text colours with the contrast panel in the converter, and see how hex colour codes work if you are new to hex.
Hex to RGB converterConvert hex colour codes to RGB, RGBA and HSL, and back. Free, no sign-up, runs in your browser.
Open the tool →FAQ
How do I add opacity to a hex colour?
Add two hex digits for alpha to the end of the code. #EF466F at 50% opacity is #EF466F80. FF is fully opaque and 00 is fully transparent.
What is 50% opacity in hex?
80. Half of 255 is 127.5, which rounds to 128, and 128 in hex is 80. So 50% black is #00000080.
What is the hex code for transparent?
Any 8-digit hex ending in 00 is fully transparent, for example #00000000. In CSS you can also just write transparent.
Do all browsers support 8-digit hex?
All current major browsers support 8-digit and 4-digit hex in CSS. If you need to support very old browsers, use rgba() instead.
Why is my Android colour wrong?
Android puts alpha first, as 0xAARRGGBB, while CSS puts it last, as #RRGGBBAA. Move the alpha pair to the front when copying a CSS colour into Android code.
Read next
- How hex colour codes work (and how to read one)Read #RRGGBB like a designer
- HSL vs RGB vs hex: which colour format should you use?Same colours, different jobs
- How hex colour codes work (and how to read one)Read #RRGGBB like a designer
- Hex to RGB converterConvert hex colour codes to RGB, RGBA and HSL, and back
- All free design toolsConverters, calculators and colour tools
Last updated 16 November 2026. Sources are linked in the text. Spotted something out of date? Email development@digitalsauce.io.
