HomeMethodBlend mode math

Blend mode math: the four lines behind Multiply, Screen and Overlay

Two layers, one expression, and a branch that most explanations put on the wrong colour. For soft light, the name covers several formulas. The harness asks your browser what it computed, by reading a pixel back through getImageData.

Independent guide. We read published definitions and measured what a browser does. We are not affiliated with Adobe or with the REA project. Nothing here is a Photoshop script, action, or preset.

Findings

From Wikipedia's Blend modes, the Multiply, Screen, Overlay, Hard light and Soft light passages, retrieved 18 Oct 2026. a is the base, b is the blend, both in 0–1.

ModeFormula as publishedConfidenceWhat it does not prove
Multiplyf(a,b) = a·bHigh—
Screenf(a,b) = 1 − (1−a)(1−b)High—
Overlay2ab when a < 0.5, else 1 − 2(1−a)(1−b)HighThat the branch is ever taken on b. When it is, the mode has a different name
Hard lightthe same pair, tested on bHigh—
Overlay is not commutativestated directlyHigh—
Soft light, Photoshop form as of 20122ab + a²(1−2b) if b < 0.5, else 2a(1−b) + a(2b−1)HighWhich build changed it, beyond the "as of 2012" framing
Soft light, earlier Photoshop form2(1−b)a + b when a ≤ 0.5, else (2a−1)(2b−1)MediumWhether any current app still uses it
Soft light, Pegtop form(1−2b)a² + 2baHigh—
Soft light, exponential forma^(2^(0.5−b)), undefined at a = 0, b = 0.5High—
W3C / Cairo / earlier PDF formg(a) = ((16a−12)a+4)a for a ≤ 0.25, else aHighThe quoted line is g(a). The harness does not run this row as a complete soft-light function
Opacity applies on top of the modePhotoshop and GIMP allow opacity on the top layerHigh—
Normal is the defaultthe default mode obscures the lower layerHigh—
Dodge, burn, hue, saturation, colour, luminositysections exist on the page—Not read in this run. The fetch cut at about 21,000 characters, before those passages. Do not copy formulas for them from this page.

Read the branch, not the name. Overlay and hard light are the same two expressions with the inputs swapped. The only difference is which colour the 0.5 test runs on. They match only at 0.5.

The rule, in pseudocode

def multiply(a, b):  return a * b
def screen(a, b):    return 1 - (1 - a) * (1 - b)
def overlay(a, b):
    return 2*a*b if a < 0.5 else 1 - 2*(1-a)*(1-b)
def hard_light(a, b):
    return 2*a*b if b < 0.5 else 1 - 2*(1-a)*(1-b)
# predicted_8bit = round(f(a/255, b/255) * 255)
Browser vs formulaOne pixel

Paints the two colours with the browser's composite operator, reads the pixel back, and compares it with each published definition. A max deviation of 0–1 means rounding only.

press Measure

Try it yourself

Do not tell me what "multiply" means conceptually. Write the per-channel
expression this application uses, then design a two-colour test that
would distinguish it from every other mode that produces a similar look.
Run the test and report the observed channel values.

The same shape — one file, several layers of responsibility — shows up in the clipboard failure ladder. How a PDF stores its objects is the companion page.

What we could not confirm. Which of the soft-light definitions a given current application ships. The harness measures your browser, not Photoshop, and Photoshop was not available to read a channel value from. If the engine works in linear light or applies a colour profile, the arithmetic still holds and the inputs are different numbers.

Next

Sources: Blend modes, Wikipedia, en.wikipedia.org/wiki/Blend_modes, retrieved 18 Oct 2026. Comply with that article's licence when reusing its wording. The formula rebuild and the canvas harness are original to this page.