Color Opacity / Alpha Mixer

Preview a semi-transparent color over a white or black background

Free color opacity mixer — blend a semi-transparent foreground color at any alpha over a chosen background and get the exact opaque hex result. See the alpha-blending formula applied live with a preview swatch. It runs free in your browser on Gera Tools, with nothing uploaded.

Last updated Source: Gera Tools

How does alpha blending work?

Each channel is mixed with the standard source-over formula: result = foreground * alpha + background * (1 - alpha). Alpha runs from 0 (fully transparent) to 1 (fully opaque), and the same formula applies to red, green, and blue independently.

The color opacity mixer flattens a semi-transparent color over a background into a single solid color. When you place an rgba() overlay on a page, the eye sees a blend of the overlay and whatever is behind it. This tool computes that blend exactly so you can capture it as an opaque hex value.

How it works

Standard source-over alpha compositing mixes each colour channel independently using the foreground alpha as a weight:

result = foreground * alpha + background * (1 - alpha)

With alpha between 0 and 1, this is applied to the red, green, and blue channels separately. An alpha of 1 returns the foreground unchanged; an alpha of 0 returns the background; an alpha of 0.5 gives the exact midpoint average of the two colors.

Each resulting channel is rounded to the nearest integer in the 0–255 range and reassembled into a hex code.

Why you need to flatten a transparent color

Transparency works in a browser because the rendering engine composites layers at paint time. But many systems cannot use transparency:

  • Design tokens and style guides — when documenting a disabled-state color as a token, a value like rgba(0,0,0,0.38) over #ffffff is hard to reference. The flattened equivalent #9e9e9e can be used directly.
  • SVG and PDF export — some exporters flatten transparency before writing; knowing the flattened value in advance avoids surprises.
  • Email clients — several desktop email clients poorly support RGBA backgrounds; using the pre-computed opaque hex avoids rendering differences.
  • Color contrast calculations — WCAG contrast ratio is defined between two opaque colors. If your text has an RGBA color, you must flatten it against the expected background before checking contrast.
  • Screenshots and headless rendering — tools like Puppeteer and Playwright composite over a default white or transparent background; if the background differs from what you expected, the apparent color differs too.

Common alpha values and what they produce

Over a white background (#ffffff), here is what different alpha levels look like for a pure black overlay (#000000):

AlphaFlattened hexEffect
0.05~#f2f2f2Barely visible tint
0.12~#e0e0e0Subtle divider shade
0.26~#bdbdbdDisabled state (Material Design)
0.38~#9e9e9eHint text
0.54~#757575Secondary text
0.87~#212121High-emphasis text
1.00#000000Fully opaque

These values come from Google’s Material Design opacity scale, which uses alpha-over-white as its token system for text hierarchies.

Example

Blend foreground #ff0000 (red) at 50% over a white background #ffffff:

  • R: 255 × 0.5 + 255 × 0.5 = 255
  • G: 0 × 0.5 + 255 × 0.5 = 128
  • B: 0 × 0.5 + 255 × 0.5 = 128

The flattened color is #ff8080, a soft pink — exactly what 50% red over white looks like.

All math runs locally in your browser — your colors are never sent anywhere.