Alpha blend calculator — the solid colour of a transparent layer

Enter a foreground colour, its opacity and the background, and the calculator gives the flat colour you actually see, with the blending formula and its contrast against the background.

Live demo · real result from this tool
Solid result#89b4fa
RGB
rgb(137, 180, 250)
Formula
result = 0.6 × foreground + 0.4 × background (per channel)
Contrast with the background
2.11:1

Colours

Translucent vs solid

Processed on your device — nothing is uploaded.

How to use the alpha blend calculator

  1. Pick the Foreground colour, the colour of the top layer.
  2. Set Foreground opacity from 0% to 100%.
  3. Pick the Background colour underneath it.
  4. Read the Solid result, its RGB value, the Formula with your numbers filled in, and the Contrast with the background.
  5. Compare the translucent and solid previews; they should look the same.

What it does and when to use it

Design files and CSS are full of semi-transparent colours: white overlays that lift cards in a dark theme, black scrims behind dialogs, tinted selection highlights. Developers and testers often need the flat colour these produce, to check contrast, to hand a value to a platform that does not support transparency, or to match a colour picked from a screenshot.

This calculator does that flattening and shows the arithmetic, so you can check it. If you start from a colour and want the CSS code for it at some opacity, the colour opacity tool is the better fit. For blend modes such as multiply and screen, use the blend mode calculator. To mix two solid colours by a ratio, use the colour mixer.

How it works

With foreground opacity a (your slider value ÷ 100, times any alpha already in the colour), each channel is:

result = a × foreground + (1 − a) × background

This is the “source-over” rule from the W3C Compositing and Blending specification, the default way one layer is drawn over another. The tool then measures the WCAG contrast ratio between the result and the background.

Worked examples

These come from the calculator.

Black at 50% on white. Solid result #808080. The formula reads result = 0.5 × foreground + 0.5 × background. Contrast with white is 3.98:1, enough for a large icon but not for body text.

Blue #3b82f6 at 60% on white. Solid result #89b4fa, from 0.6 × foreground + 0.4 × background. Contrast with white drops to 2.11:1.

A dark-theme elevation overlay. White at 15% on navy #0f172a gives #333a4a. Its contrast with the navy is 1.56:1, so it reads as a raised surface, not as a border.

Limits and tips

  • Only normal blending is covered. Layers set to multiply, screen or other modes need the blend mode calculator.
  • Over images and gradients the result changes pixel by pixel; use the colour behind the most important area.
  • The calculation runs in your browser.

Frequently asked questions

What is alpha blending?
It is how a screen shows a see-through colour. Each red, green and blue value of the result is a weighted average of the foreground and background, weighted by the foreground's opacity. At 60% opacity, the result is 60% foreground and 40% background.
Why does 50% black on white give
Half of 255 is 127.5, which rounds up to 128, or 80 in HEX. Rounding is done once, at the end.
Does this match what browsers draw?
Yes for normal layers. Browsers blend on the usual gamma-encoded sRGB values with the same source-over formula, so the HEX here matches what you would pick from a screenshot, give or take one step of rounding.
Why does it show contrast with the background?
A translucent colour always sits closer to its background than the solid version does. If you use the blend for a border, divider or text, the ratio tells you whether it is still visible enough.
What if the background is also transparent?
The calculator treats the background as solid. For stacked transparent layers, blend the lowest layer onto the page colour first, then use that result as the next background.

Sources

  1. Compositing and Blending Level 1 — simple alpha compositing (source-over) — W3C, accessed 2026-10-08

Written by the ToolsRift team · Last updated

Pages are drafted with AI assistance and checked by automated tests. How we write and check pages.

Was this tool useful?

Report a problem

Start typing to search every tool.

↑ ↓ to moveEnter to openEsc to close