Skip to content
Hex Calculator

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.

Result
rgba(37, 99, 235, 0.5) — #2563EB80

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
StepDescriptionResult
Convert hex to RGB#2563EB -> rgb(37, 99, 235)R=37 G=99 B=235
Convert opacity to decimal alpha50 / 1000.5
Build the rgba() valuecombine RGB with decimal alphargba(37, 99, 235, 0.5)
Convert opacity to a hex alpha byte0.5 x 255, rounded80 (hex)
Append to the hex color2563EB + 802563EB80

rgba() and 8-digit hex represent the exact same transparency — pick whichever format fits the surrounding CSS or design tool better.

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.

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.