Hex Color Opacity Calculator
Apply a percentage opacity to any hex color and get both the CSS rgba() value and the 8-digit hex-with-alpha code back in one step.

Built by
Swapnil SanghviFull-Stack Web Developer & WordPress Developer
Swapnil Sanghvi is a full-stack web and WordPress developer, UI designer, and full-time freelancer who builds and maintains Hex Calculator.
Further reading: CSS Colors — W3Schools
How Hex Color Opacity Is Calculated
The hex color converts to its RGB channels first, unchanged. The opacity percentage then becomes the alpha component in two equivalent forms: a 0-1 decimal for the CSS rgba() function, and a 2-digit hex value (0-255 scaled) appended to the original 6-digit hex code to form an 8-digit hex-with-alpha color.
Hex Color Opacity Example, Step by Step
#2563EB at 50% opacity = rgba(37, 99, 235, 0.5) — #2563EB80
#2563EB at 50% opacity = rgba(37, 99, 235, 0.5) — 2563EB80
#2563EB -> rgb(37, 99, 235) Alpha as decimal: 50 / 100 = 0.5 Alpha as hex byte: 0.5 x 255 = 127.5 -> 128 (0x80) rgba(37, 99, 235, 0.5) 2563EB80
| Step | Description | Result |
|---|---|---|
| Convert hex to RGB | #2563EB -> rgb(37, 99, 235) | R=37 G=99 B=235 |
| Convert opacity to decimal alpha | 50 / 100 | 0.5 |
| Build the rgba() value | combine RGB with decimal alpha | rgba(37, 99, 235, 0.5) |
| Convert opacity to a hex alpha byte | 0.5 x 255, rounded | 80 (hex) |
| Append to the hex color | 2563EB + 80 | 2563EB80 |
rgba() and 8-digit hex represent the exact same transparency — pick whichever format fits the surrounding CSS or design tool better.
Where Hex Color Opacity Actually Comes Up
Generating a Hover or Overlay Tint
UI components often need a subtle transparent version of a base color for hover states or overlays — this produces both CSS formats you'd need at once.
base color @10% -> hover tint
Creating a Disabled-State Color
Reducing a color's opacity is a common way to signal a disabled or inactive UI element while keeping it visually related to its active-state counterpart.
button color @40% -> disabled state
Building a Semi-Transparent Scrim or Shadow
Modal backdrops and drop shadows typically use a low-opacity black or dark color — this calculates the exact rgba() or 8-digit hex value needed.
000000 @50% -> modal backdrop
Common Mistakes With Hex Color Opacity
- Confusing hex-with-alpha's last 2 digits with a regular color channel — they represent alpha (0-255 scale), not a fourth color.
- Entering an opacity value above 100 or below 0, which don't correspond to a valid alpha channel.
- Forgetting some older tooling and email clients don't support 8-digit hex or rgba() — check compatibility if targeting legacy environments.
Why Use This Calculator Instead of Doing the Math Yourself
- Produces both rgba() and 8-digit hex at once, no separate conversion needed
- Runs entirely in your browser — nothing you type gets sent anywhere
- Handles the alpha scaling and rounding automatically
- Flags out-of-range opacity values instead of producing an invalid color
Limitations
- Alpha is expressed as an 8-bit value (0-255) appended to the hex color — some tools instead expect a 0-1 decimal or percentage, so check what your target format needs.
Frequently Asked Questions
How does this calculator apply opacity to a hex color?
It converts the hex color to RGB, then attaches the opacity percentage as an alpha value — producing both a CSS rgba() string (alpha as a 0-1 decimal) and an 8-digit hex code (alpha as 2 extra hex digits) at the same time.
What's #2563EB at 50% opacity?
rgba(37, 99, 235, 0.5) — and as 8-digit hex, 2563EB80, where 80 (hex) is 128 (decimal), roughly half of 255.
Do all browsers support 8-digit hex colors?
Yes — every modern browser supports #RRGGBBAA hex notation, where the last two digits set the alpha channel the same way rgba()'s fourth value does.
What does 0% opacity produce?
A fully transparent color — rgba(r, g, b, 0) and a hex-with-alpha code ending in 00, meaning the color is invisible regardless of its RGB values.
Is rgba() or 8-digit hex better to use in CSS?
Functionally identical — rgba() is more explicit about the alpha value at a glance, while 8-digit hex is more compact and pastes easily alongside a regular 6-digit hex code.
How do I create a hover or overlay color for a design system?
Apply a low opacity (often 5-15%) to your base color here to generate a subtle hover or overlay tint that still reads as the same color family, in both rgba() and 8-digit hex form.
What opacity should I use for a disabled-state color?
There's no universal number, but 38-50% opacity is a common range for disabled UI elements — enough to read as inactive while the underlying color remains identifiable.