What Is Opacity in Colour Codes?
Opacity (or alpha) controls how transparent a colour is: 100% is fully solid, 0% is invisible, and values in between let the background show through. On the web, you can add opacity to a colour in several ways: an 8-digit HEX code (#2563EB80), rgba() (rgba(37, 99, 235, 0.5)), hsla(), or the CSS opacity property on a whole element. Designers use transparency for overlays on photos, glass effects, subtle tinted backgrounds, disabled states, shadows and focus rings.
The tricky part is that HEX alpha uses base 16 on a 0–255 scale, so 50% opacity isn't "50" but "80". This opacity calculator converts instantly between percentages, hex alpha, decimal alpha and every colour format.
How to Use the Opacity Calculator
- Enter your colour as HEX, RGB, HSL or a colour name.
- Set the opacity with the slider or type a percentage.
- Copy the result as 8-digit HEX, RGBA, HSLA or Android's #AARRGGBB.
- Set the background to see the equivalent solid colour: the flat HEX that looks identical on that background.
- Reverse lookup: type two hex digits (e.g. CC) to see the opacity percentage, or click any row of the table.
How Hex Opacity Is Calculated
Multiply the opacity (0–1) by 255, round to a whole number, and convert it to two hex digits. For 50%: 0.5 × 255 = 127.5, which rounds to 128 = 80 in hex. For 75%: 191.25 rounds to 191 = BF. To go back, convert the hex to decimal and divide by 255: CC = 204, and 204 ÷ 255 = 80%.
| Opacity | HEX | Opacity | HEX |
|---|---|---|---|
| 100% | FF | 45% | 73 |
| 90% | E6 | 40% | 66 |
| 80% | CC | 30% | 4D |
| 75% | BF | 25% | 40 |
| 70% | B3 | 20% | 33 |
| 60% | 99 | 10% | 1A |
| 50% | 80 | 5% | 0D |
Transparent vs Solid: The Flattened Colour
A transparent colour looks different on every background. rgba(37, 99, 235, 0.1) on white is a pale blue (#E9EFFD), but on dark grey it becomes a dark bluish grey. The calculator computes the flattened solid colour using the standard alpha-compositing formula: result = colour × alpha + background × (1 − alpha), for each channel. Using the solid colour is often better than using transparency:
- It looks identical everywhere, even when elements overlap or backgrounds change.
- Contrast checkers and design handoff tools can measure it exactly.
- It avoids stacked-transparency surprises, where two 50% layers make 75%.
CSS opacity vs RGBA
The CSS opacity property makes an entire element, including its text, images and children, transparent. An RGBA or 8-digit HEX colour makes only that colour transparent. For a translucent background behind fully opaque text, use background: rgba(0, 0, 0, 0.5), not opacity: 0.5.
Platform Differences
- CSS and Figma: #RRGGBBAA, with alpha last.
- Android (XML, Compose): #AARRGGBB, with alpha first, so 50% blue is #802563EB.
- iOS / Swift: UIColor(red:green:blue:alpha:) with 0–1 values.
- Many design tools show opacity separately as a percentage.
Opacity and Accessibility
Semi-transparent text and icons are a common cause of accessibility failures. A grey that passes at full opacity may fail once it's 60% transparent, because its effective colour gets closer to the background. WCAG contrast must be measured on the flattened colour, which is exactly what this calculator shows. Before using transparency for text, placeholders, disabled buttons or icons, copy the solid equivalent into the Color Contrast Checker and make sure it reaches at least 4.5:1 for normal text or 3:1 for large text and UI components. For disabled states, WCAG makes an exception, but the text should still be readable enough for people to understand what's unavailable.
Common Transparent Overlay Values
- Modal backdrop: black at 40–60% (#00000066 to #00000099).
- Image text overlay: black at 30–50%, or a gradient from 0% to 65%.
- Hover highlight: the brand colour at 8–12% over white.
- Divider lines: black at 8–12% on light themes, white at 10–15% on dark themes.
Frequently Asked Questions
What is 50% opacity in hex?
80 (decimal 128), so #000000 at 50% is #00000080.
What is 20% opacity in hex?
33, e.g. #FFFFFF33.
Do 8-digit hex codes work in all browsers?
Yes. All modern browsers support #RRGGBBAA and 4-digit #RGBA.
How do I make a colour transparent in CSS?
Use rgba(r, g, b, 0.5), an 8-digit hex, or color-mix(in srgb, colour 50%, transparent).
Why does my transparent colour look different in dark mode?
Because the background shows through. Use the flattened solid colour for each theme if you need consistency.