How colours combine when they overlap
CSS blend modes control the maths used when one layer is composited over
another — the same Multiply, Screen and Overlay modes you know from image
editors. They power mix-blend-mode (blend an element with the page behind it)
and background-blend-mode (blend a box’s own background layers). This reference
lists every value with its real W3C compositing formula and effect, plus a
calculator that applies the formula to a single colour channel.
How it works
Separable modes work per channel on values normalised to the 0–1 range. A few
core formulas, using Cb for backdrop and Cs for source:
multiply: B = Cb × Cs
screen: B = Cb + Cs − Cb × Cs
overlay: B = hard-light(Cs, Cb)
difference: B = |Cb − Cs|
exclusion: B = Cb + Cs − 2 × Cb × Cs
The calculator takes 0–255 inputs, normalises to 0–1, applies the exact formula
(including the piecewise soft-light and hard-light definitions and the
divide-by-zero guards in color-burn/color-dodge), then scales back to 0–255.
The four non-separable modes — hue, saturation, color, luminosity —
recombine HSL components of the whole colour and so cannot be reduced to a single
channel; the tool flags those rather than returning a wrong number.
Tips and notes
multiplyalways darkens,screenalways lightens — white and black are their neutrals.overlay/hard-lightare the same formula with operands swapped.- Non-separable modes (
hue,saturation,color,luminosity) work in HSL, not per channel. mix-blend-modeon a non-isolateparent can blend with siblings — wrap inisolation: isolateto scope it.