Chemical Equation Balancer

Solved as a nullspace in exact fractions, then re-counted element by element as a real check.

Clear
Balanced equationC6H12O6 + 6O2 → 6CO2 + 6H2O
Coefficients1, 6, 6, 6reactants first, then products, in the order written
Atoms of C6 each side6 in, 6 out
Atoms of H12 each side12 in, 12 out
Atoms of O18 each side18 in, 18 out
Mass of the reactants372.144 g/moland of the products too — that is what balancing means
Every element was re-counted from the balanced equation and both sides agree, so this is verified rather than asserted.

The formula

nullspace of the element-by-species matrix, in exact rationals

Balancing is linear algebra

Write one row per element and one column per species, with the products carrying a minus sign. Any vector that the matrix sends to zero is a set of coefficients that conserves every element at once. Balancing an equation by inspection is doing this arithmetic in your head, which is why it gets hard the moment a reaction has more than four or five species.

Why exact fractions

The elimination here is done in rational arithmetic rather than decimals. The answer is always a set of small whole numbers, and a floating-point result of 1.9999999999999998 cannot be rounded to 2 with any confidence once the numbers get larger. Working in fractions means the coefficients come out exactly and the check at the bottom of the page is a real check rather than a tolerance.

When there is more than one answer

Occasionally the nullspace has two or more dimensions. That is not a failure of the method: it means the equation as written is really two independent reactions sharing a line, and any mixture of them balances. The page reports that instead of picking one.

Balanced first, always

Every quantity on this page depends on a balanced equation. The coefficients set the molar ratio, the ratio sets the theoretical yield, and the yield is what the percentage is measured against. An unbalanced equation does not give a slightly wrong answer — it gives an answer to a different question.