Color Alpha Blending Calculator

Enter a foreground color, its opacity, and a background color to see the exact blended result.

Foreground
Background
Result
Enter colors and opacity to see the blended result.

What happens when a transparent color sits over another color?

Transparency is everywhere in modern design: a dark overlay that dims a photograph behind a headline, a tinted panel floating over a patterned background, a hover state that darkens a button by a fraction. In each case the color you actually see is neither the foreground color nor the background color, but a blend of the two, and the blend follows a precise formula called alpha compositing. The alpha value, a number from zero to one, says how opaque the foreground is: zero means fully transparent, so you see only the background, one means fully opaque, so you see only the foreground, and a half means an equal mix of both. Designers who guess at the result often end up with text that is too low contrast, overlays that look muddy, or brand colors that shift unexpectedly when placed over different backgrounds, and calculating the blend removes the guesswork.

The formula is applied separately to the red, green, and blue channels. For each channel, the result equals the foreground value times alpha, plus the background value times one minus alpha, rounded to the nearest whole number. A red foreground of 255 at fifty percent opacity over a white background of 255, 255, 255 gives red 255, because both layers contribute full red, green 128, because the foreground contributes zero and the background contributes half of 255, and blue 128 for the same reason, producing the soft pink hex code FF8080. The same red at twenty-five percent over white gives a much paler pink, while at ninety percent it is nearly pure red, and the relationship is linear, so each step of opacity moves the result proportionally toward the foreground. This calculator performs that arithmetic for all three channels at once and reports the result as both RGB values and a hex code you can paste directly into CSS.

How AlphaBlend works

Enter the foreground color as three numbers from zero to 255, enter its opacity as a decimal from zero to one, and enter the background color the same way, and the calculator returns the exact blended color. The three swatches update to show the foreground, the background, and the result side by side, which is often more informative than the numbers alone, because it reveals at a glance whether the blend is too pale, too dark, or shifted in hue. The presets cover the most common cases: a red tint at half opacity over white, a black scrim at quarter opacity over white, which is the classic way to darken a photograph slightly, and a teal overlay at eighty percent over a mint background. Use the presets as starting points, then adjust the opacity in small steps to fine-tune the result.

The calculator assumes an opaque background, which is the normal case for web design, where a page background or a photograph sits beneath the transparent layer. If both layers were transparent, the result would itself be partly transparent and would need a further blend against whatever lies beneath, but that chain eventually bottoms out at an opaque surface, and the final visible color is what matters for contrast and appearance. Rounding follows the usual rule of rounding halves upward, matching how browsers and design tools quantise blended colors to whole channel values, so the hex code from this calculator should match what you see in a browser when you layer the same colors with CSS opacity or an RGBA value.

Why blended colors surprise designers

The most common surprise is that a transparent black overlay does not simply darken a color, it also desaturates the relationship between channels in a way that can shift the perceived hue, especially over saturated backgrounds. A fifty percent black overlay over a vivid red does not produce a darker vivid red so much as a muted, brownish red, because every channel is pulled halfway toward zero, and the ratios between channels change. Similarly, a white overlay over a dark blue does not produce a lighter blue of the same character, it produces a paler, greyer blue, because the channels are pulled toward white. These shifts are mathematically correct and visually real, which is why designers who specify a brand color as a transparent layer over varying backgrounds often find the brand looking inconsistent, and why it is usually better to specify the final blended color directly when consistency matters.

A second surprise is contrast. Text placed over a blended background must meet contrast requirements against the blended result, not against either layer alone, and a white headline that is perfectly legible over a dark photograph can become illegible over the same photograph with a light overlay, or vice versa. Always measure contrast against the final blended color, which this calculator gives you, and check it at the actual text size, because large text needs less contrast than small text. A third surprise is stacking: two layers of fifty percent black do not equal one layer of one hundred percent black, they equal seventy-five percent black, because the second layer darkens what remains after the first, and each additional layer has diminishing effect. If you stack overlays, calculate the cumulative result rather than adding opacities.

Overlays, scrims, and readability

The classic use of alpha blending is the scrim: a semi-transparent dark layer placed over a photograph so that white text on top of it becomes readable. A black overlay at forty to sixty percent opacity usually achieves this while keeping the photograph recognisable, while below thirty percent the text may still struggle against bright areas of the image, and above seventy percent the photograph becomes so dark that it might as well be a solid background. The right value depends on the photograph's brightness range: a bright, high-key photograph needs a stronger scrim than a dark, moody one, and a gradient scrim, darker at the bottom where the text sits and transparent at the top, often works better than a uniform overlay, because it preserves the image where there is no text. Calculate the blend at the text's location, not at the image's average, because local contrast is what the reader experiences.

Light scrims work the same way in reverse: a white overlay at fifty to seventy percent over a busy pattern creates a calm surface for dark text, and is a popular technique for cards over photographic backgrounds. Tinted scrims, such as a brand color at low opacity over a photograph, can unify a set of images, but they shift every image toward the brand hue, which suits marketing material and harms documentary photographs where accurate color matters. In all cases, prefer a single overlay with a calculated opacity over multiple stacked overlays, because a single layer is easier to reason about, easier to adjust, and easier to document for the next designer who inherits the file.

Alpha in CSS: opacity, RGBA, and hex alpha

CSS offers three common ways to express transparency, and they are not interchangeable. The opacity property makes an element and everything inside it transparent, including its text and children, which is rarely what you want for a panel containing text, because the text becomes washed out too. RGBA colors, such as rgba(0, 0, 0, 0.5), make only the color transparent, leaving the text inside fully opaque, which is almost always the correct choice for backgrounds and overlays. Eight-digit hex colors, such as #00000080, encode the same information as RGBA in a compact form, with the last two digits representing alpha on a scale from 00 to FF, and they are convenient when a design system already uses hex codes. Whichever form you use, the blending maths is identical, and the final visible color is the one this calculator reports.

When you need the blended color as a solid value, for example to match a color in a print file, to set a fallback for an old browser, or to measure contrast with a tool that does not understand transparency, use the calculator's hex output as the solid equivalent. That solid color looks identical over the same background, though it will not adapt if the background changes, which is the trade off of flattening transparency. Keep the original RGBA value in your source as a comment, so a future change of background can be recalculated rather than guessed, and document the intended background alongside any solid equivalent, because a flattened color without its background context is just a mystery number.

Common blending mistakes

The most common mistake is specifying text contrast against the unblended foreground or background instead of the blend, which produces pages that pass a contrast checker in a design tool and fail in a browser. The second is stacking transparent layers without calculating the cumulative effect, which produces darker or lighter results than intended. The third is using opacity on a container instead of RGBA on its background, which fades the text as well as the panel. The fourth is assuming a transparent brand color looks the same everywhere, when in fact it shifts with every background it sits over. The fifth is forgetting that printed output flattens transparency differently from screens, so always check a printed proof if a design will appear in print as well as on screen.

ForegroundAlphaBackgroundResult
Red (255, 0, 0)0.5White#FF8080
Black (0, 0, 0)0.25White#BFBFBF
Blue (0, 0, 255)1.0White#0000FF
Teal (15, 118, 110)0.8Mint (240, 253, 250)#3C918A

Transparency is a precise tool, not a guessing game. Blend it, see the exact result, and design against the color your users will actually see.

Frequently asked questions

How do you calculate a blended color?

For each RGB channel, result equals foreground times alpha plus background times one minus alpha, rounded to a whole number. Alpha ranges from 0 (transparent) to 1 (opaque).

What does red at 50% over white become?

It becomes #FF8080, a soft pink: red stays 255, while green and blue become half of 255, which is 128 each.

Is opacity the same as RGBA?

No. Opacity makes an element and its children transparent, including text. RGBA makes only the color transparent, so text inside stays fully opaque.

What happens when you stack two 50% black layers?

You get 75% black, not 100%. The second layer darkens what remains after the first, so each layer has a diminishing effect.

Why does my brand color look different over photos?

A transparent brand color blends with each background, so it shifts hue and lightness everywhere it is used. For consistency, use the calculated solid blend instead.

How do I check contrast for text over a transparent overlay?

Check contrast against the final blended color, which this calculator reports, not against the overlay or the background alone.

What is 8-digit hex color?

It is a hex code with an alpha channel appended, like #00000080 for black at 50% opacity. The last two digits range from 00 (transparent) to FF (opaque).

Does alpha blending work the same in print?

Not exactly. Print flattens transparency when files are prepared, so always check a printed proof if your design will appear in print as well as on screen.