Skip to tool
ecech.
🎨 Design & Color

Hex Alpha Calculator That Admits 80 Is Not Exactly 50 Per Cent

Convert between hex alpha and percentage, and see the flat colour a semi-transparent layer actually produces over your background.

Alpha byte

Exact percentage

8-digit hex

Flattened over background

What it looks like

Copy-ready

The common chart values, exactly

Advertisement

How the calculation works

Why every hex opacity chart is a rounding Alpha is one byte: 0 to 255. Exactly 50% would be 127.5. 7F = 127 49.804% 127.5 — does not exist exactly 50% 80 = 128 50.196% Both neighbours are defensible, which is why charts disagree and neither is wrong. The error is 0.2 of a percent. It matters for nothing visual — and for anything comparing strings.

How to Use This Tool

Type a colour, a background and an opacity. You get the eight-digit hex, the exact percentage, and the solid colour the layer flattens to.

80 is not 50 per cent

Alpha is stored as one byte, 0 to 255. Exactly half of 255 is 127.5, which is not a whole number, so no byte represents exactly 50%.

  • 7F is 127 → 49.804%
  • 80 is 128 → 50.196%

Charts pick one and print “50% = 80”. That is a reasonable rounding, not a fact, which is why two charts can disagree and neither is wrong. The gap is two tenths of a percent — invisible on screen, and relevant the moment two systems compare colour strings and expect a match.

Fifty is not a special case. Across the whole range only six whole percentages land on a whole byte at all: 0, 20, 40, 60, 80 and 100. Every other value in every opacity chart you have ever used is rounded, including the ones that look tidy.

opacity and alpha are not the same property

These look interchangeable and are not:

  • background: #3B82F680 makes that colour semi-transparent. Text inside the element stays fully opaque.
  • opacity: .5 makes the whole element semi-transparent after rendering, including every child. It also creates a stacking context, which can quietly change how z-index behaves elsewhere on the page.

Swapping one for the other usually looks similar in an empty box and diverges the moment the box has content.

Same 50%, different result Readable background: #3B82F680 only the fill is transparent Faded too opacity: .5 the whole element, text included
The right-hand label is the same colour as the left one. Only the container differs.

The blend matches your browser, not colour theory

The flattened colour here is computed the way browsers composite: straight arithmetic on the gamma-encoded sRGB values. So 50% white over black gives #808080.

Physically that is wrong. Light does not add that way, and blending in linear space would give roughly #BCBCBC — which is what “half as bright” actually looks like. Browsers do it the simple way anyway, for compatibility reasons that predate anyone worrying about it.

This tool matches the browser deliberately. A calculator that produced the physically correct answer would disagree with every screenshot you take, and you would trust the screenshot.

Where the flattened value is worth having

Transparency costs a compositing layer, and semi-transparent text fails contrast checks in ways that are hard to reason about. If a colour always sits on a known background, using the flattened solid instead is cheaper, and it gives you a real value to run through a contrast checker.

Advertisement

Frequently Asked Questions

Is 80 in hex exactly 50% opacity?
No. 0x80 is 128, and 128 divided by 255 is 50.196%. Exactly 50% would need 127.5, which is not a whole byte, so no hex value represents it. 7F is 127, or 49.804%. Charts pick whichever neighbour they prefer, which is why two charts can disagree and neither is wrong. Across the whole range only 0, 20, 40, 60, 80 and 100 per cent land on a whole byte — everything else in every chart is rounded.
What is the difference between opacity and an alpha channel?
An alpha channel like #3B82F680 makes that one colour semi-transparent, so text inside the element stays fully opaque. opacity: .5 makes the entire element semi-transparent after rendering, children included, and it creates a stacking context that can change how z-index behaves elsewhere. They look identical on an empty box and diverge as soon as it has content.
Why does 50% white over black give #808080 rather than something lighter?
Because browsers composite using straight arithmetic on gamma-encoded sRGB values rather than in linear light. Physically, half the light would land near #BCBCBC. Browsers do the simple thing for compatibility reasons, so this calculator does too — a physically correct answer would disagree with every screenshot you take.
Should I use the flattened colour instead of transparency?
Often yes, when the background is known and fixed. Transparency costs a compositing layer, and semi-transparent text is awkward to reason about for contrast. The flattened solid is cheaper and gives you a real value to put through a contrast checker.
Do all browsers support 8-digit hex?
Yes, in every current browser. The four and eight digit forms with alpha are part of CSS Color Level 4 and have been widely supported for years. If you need to support something very old, rgba() is the equivalent.
Is anything sent to a server?
No. The conversion and blending are arithmetic done in your browser. Nothing is uploaded.

Related tools in Design & Color

Browse all Design & Color tools
The Mac mini the ecech. site is built on, beside a handwritten note reading ecech.com.

Made by one person

ecech. is not a content farm. Every tool here is written and checked by hand, one at a time, by someone who wanted the tool to exist and could not find a version that showed its working.

No accounts and no sign-in, and nothing you type reaches a server — every calculation on this page runs inside your browser. The ads are served by Google and do set their own cookies, which is set out in full on the privacy page. More about the site.