RGB Alpha Source Over Calculator
Combine foreground and background colors with separate opacity values and report straight and premultiplied output channels.
YOUR CALCULATION
Result
—
Calculation steps
Work through one step at a time or reveal the complete calculation. The steps use your current inputs.
How to calculate
Premultiply both colors by their alpha, apply source-over composition and divide by resulting alpha to recover straight channels when nonzero.
αout=αf+αb(1−αf); premultiplied C=αfCf+αb(1−αf)Cb
Worked example
Half-opaque red over opaque blue gives alpha 1 and encoded-channel RGB (127.5,0,127.5), rounded to #800080.
Assumptions and input details
Six-digit sRGB hex colors with straight alpha; opacity 0–100%. Arithmetic is explicitly performed on encoded sRGB channels, without linear-light conversion or other blend modes. This convention can differ from color-managed linear-light rendering. At zero output alpha, straight RGB is undefined and reported as such. Hex output rounds each channel to an 8-bit byte. No image is uploaded or edited.
References: W3C: simple alpha compositing
Using this calculator
Can I enter my own problem?
Yes. Replace the example values with your own inputs. The result, calculation steps, tables and applicable diagrams update from those inputs. Blank or invalid values clear the result; example values are never silently substituted for missing inputs.
Are the results exact?
Results use floating-point arithmetic and displayed rounding. Read the formula, assumptions and any stated data precision before interpreting the result.
Is my input uploaded?
The calculation runs in your browser. No account, file upload or external AI service is required. Inputs are not saved between page reloads.
Convert opaque sRGB color codes between HEX, integer RGB and HSL. See unrounded channel values and the nearest 8-bit HEX representation.
Compare two opaque sRGB colors, inspect a text preview and check WCAG 2.2 contrast thresholds for normal and large text.
Convert px, rem, em, percent and CSS point sizes using separate entered root and parent font sizes.
Reserved advertising space.