← Back to ElementVault
Chemistry · Calculator

Chemical Equation Balancer

Gaussian elimination · smallest integer coefficients · atom-balance check
Chemical equation
Try: Fe + O₂ → Fe₂O₃ H₂ + O₂ → H₂O Al + HCl C₃H₈ combustion KMnO₄ + HCl Superphosphate Cu + HNO₃ Glucose
Balanced Equation
Atom Balance Check
Method
Need to compute yields or check solubility?
The full ElementVault workbench includes Stoichiometry (limiting reagent + percent yield), Solubility Tables (predict precipitates), and 10 other chemistry calculators. The Balance → Solubility → Stoichiometry pipeline is built in.
Open full workbench →

What this balancer does

Type a chemical equation — reactants on the left, products on the right, separated by an arrow ( or ->) — and the balancer returns the smallest set of positive integer coefficients that make every element's atom count equal on both sides. It also shows the per-element check so you can verify the balance by eye.

Unlike trial-and-error, the algorithm is deterministic: for any balanceable equation it returns the unique smallest-integer answer, and for non-balanceable equations it tells you so instead of looping forever.

How it works — the algebraic method

Every compound in the equation gets a coefficient (call them a, b, c, …). The constraint that each element must balance on both sides gives one linear equation per element. So if your equation has n compounds and k elements, you have k equations in n unknowns. Writing this as a matrix:

  1. Each row of the matrix represents one element.
  2. Each column represents one compound.
  3. The entry is the number of atoms of that element in that compound — positive for reactants, negative for products.
  4. The balanced equation is a nontrivial solution to Ax = 0 — i.e. a vector in the matrix's null space.

The balancer solves this via Gaussian elimination with partial pivoting, treats the last unknown as a free variable (= 1), and back-substitutes. The resulting rational coefficients are converted to integers by taking the LCM of fractional denominators, then reduced by the GCD to ensure the answer is in lowest terms.

Worked example: KMnO₄ + HCl → KCl + MnCl₂ + H₂O + Cl₂

Six compounds, four elements (K, Mn, O, H, Cl — five elements, actually). The balancer constructs a 5×6 matrix:

Solving this system gives 2 KMnO₄ + 16 HCl → 2 KCl + 2 MnCl₂ + 8 H₂O + 5 Cl₂, which the atom check then verifies: 2 K on each side, 2 Mn on each side, 8 O on each side, 16 H on each side, 16 Cl on each side. ✓

What this balancer can and can't do

Can:

Can't:

Common errors

Case matters. Co is cobalt, CO is carbon monoxide. NACL won't parse — it has to be NaCl.

Use → or -> between sides. Equal signs work too (A + B = C), but use exactly one separator. Multi-step reactions need to be balanced one step at a time.

If the balancer can't solve it, check the chemistry, not the math. The most common cause is a missing product or reactant. The balancer is honest: if the atom counts can't balance with positive coefficients, the equation as written is wrong.

Frequently asked questions

How does the balancer find the coefficients?

It uses the algebraic method: each compound's atom counts become a column in a matrix, with reactants positive and products negative. Solving Ax = 0 (finding the null space) via Gaussian elimination gives the relative coefficients. The result is then scaled to the smallest positive integers by taking the LCM of fractional denominators and dividing by the GCD.

Why can't it balance some redox equations?

The algebraic method requires the equation to be balance-able from atom counts alone. Redox reactions involving incomplete species (like writing only the oxidizing agent without the reducing agent's oxidized form) have multiple valid balance solutions or none. For half-reactions or unfinished redox equations, you need the half-reaction method, which tracks electron transfer separately.

Does it handle polyatomic ions and parentheses?

Yes — Ca3(PO4)2, Al2(SO4)3, Cu(NO3)2 all parse correctly because the parser handles nested parentheses with subscripts. Hydrate notation with middle dots (CuSO4·5H2O) also works.

What does the "atom balance check" show?

After computing coefficients, the calculator counts atoms of each element on the left and right side. For a correctly balanced equation, every row reads element: N = N ✓. If any row doesn't match, the result block won't display — you'll see an error instead.

Why does it sometimes say "use → not =" when I used →?

The parser accepts , ->, =>, or = as separators. The error fires only if the input doesn't contain exactly one of these. If you have two arrows (e.g. A → B → C) or none, the parser can't split reactants from products.

Can I use the balanced equation for stoichiometry?

Yes — open the full ElementVault workbench. Its Equation Balancer has a Send to Stoichiometry button that carries the balanced equation directly into the yield calculator, where you set the limiting reagent and compute product amounts.