Skip to content

Chemical equation balancer

Type a reaction for the smallest whole numbers that balance it, solved exactly rather than by trial and error, and refused outright when there is no answer.

Balanced equation

C3H8 + 5 O2 = 3 CO2 + 4 H2O

the smallest whole numbers that balance it — any multiple of them is equally correct

Coefficients in the order you typed

1 : 5 : 3 : 4

Atoms of each element, on either side

C 3 H 8 O 10

Aν = 0, ν = null space of A, divided by gcd

Balancing by trial and error works until the equation is big enough that it does not, and then it turns into guessing with extra steps. There is an exact method, and it is the one IUPAC states: write the conservation matrix A, whose entry in row i column j is the number of atoms of element i in species j, and the coefficients are the null space of that matrix. This page solves it in whole-number arithmetic from beginning to end — no decimals, no rounding, no "close enough" — then divides the answer down to the smallest whole numbers. It also tells you when there is no answer, or more than one, instead of picking something and looking confident.

How it is calculated

Aν = 0, ν = null space of A, divided by gcd

A is the conservation matrix: one row per element, one column per species, holding the number of atoms of that element in that species, positive on the left of the arrow and negative on the right. Any vector ν in its null space balances the equation. The dimension of that null space is the number of independent reactions your species can undergo: zero means the equation cannot be balanced, one means there is a single answer up to a common factor, and more than one means the species you listed describe several reactions at once. Only the second case gets an answer here.

Source: IUPAC, Quantities, Units and Symbols in Physical Chemistry (the Green Book), 3rd edition, 2nd printing 2012, Sec. 2.10.1 (iv), symbolic and matrix notation for chemical equations, pp. 52-53 — a general chemical equation is written 0 = Σj νj Bj, and in matrix form Aν = 0, where A is the conservation (or formula) matrix with elements Aij representing the number of atoms of the ith element in the jth reaction species; the stoichiometric number matrix ν "can be determined as the null space of A", and the nullity N(A) = Ns − rank(A) "gives the number of independent chemical reactions"

Questions people ask

Why does it refuse an equation instead of giving me something?
Because there are two failures that look like an answer if you paper over them. An equation with an element on one side only — H2 + O2 = HCl — has no balancing at all, and the honest output is to say so. An equation whose species span several reactions, such as C + O2 + H2 = CO + CO2 + H2O, has infinitely many balancings that are not multiples of one another; any single set of coefficients a page shows you there was chosen by the page, not required by the chemistry. Split it into the separate reactions and each one balances on its own.
Can I type coefficients in myself?
You can, and they are ignored. The point of the page is to work out the coefficients, so anything you write in front of a formula is stripped before the equation is read — 3 N2 + 9 H2 = 4 NH3 comes back as N2 + 3 H2 = 2 NH3. That is also a quick way to check homework: type what you got and see whether it reduces to the same thing.
Why are my coefficients smaller than the ones in my textbook?
Because a balanced equation is not unique. IUPAC puts it plainly: stoichiometric numbers are not unique, and one and the same reaction can be expressed in different ways without any change in meaning — (1/2) H2 + (1/2) Br2 = HBr and H2 + Br2 = 2 HBr say the same thing. This page always gives the smallest set of whole numbers, so if your book doubles everything to avoid a half, or writes a half to make an electron count come out at one, both of you are right.
Does it handle ionic equations and charges?
No, and it says so rather than mangling them. The formula reader here counts atoms; it has no notion of charge, so MnO4- and H+ are not accepted and a net ionic equation cannot be balanced for charge as well as for mass. Write the full molecular equation with the spectator ions in place — the permanganate example is a redox reaction balanced exactly that way — or balance the half equations by hand.
What can it read?
Everything the molar mass page reads, because it is the same formula parser: brackets and nesting, K4[Fe(CN)6], and hydrates written with a dot, CuSO4·5H2O. Reactants and products are separated by an equals sign or any of the usual arrows — ->, →, ⇌ — and species by a plus. It stops at 24 species, which is well past anything a school exercise asks for.
Is whole-number arithmetic really necessary?
For a small equation, no. For a big one, yes, and the failure is silent. Gaussian elimination in floating point turns exact zeros into values around 1e-16, and the rank of the matrix — which is what decides whether the equation has no answer, one, or many — is exactly the count of rows that are not zero. Get one of those wrong and the page confidently balances an equation that has no balancing. Everything here runs on integer fractions, so a zero is a zero.

Sources

The documents this page reads its numbers out of, linked so you can check them yourself.

  1. IUPAC, Quantities, Units and Symbols in Physical Chemistry (the Green Book), 3rd edition, 2nd printing 2012, Sec. 2.10.1 (iv), symbolic and matrix notation for chemical equations, pp. 52-53 — a general chemical equation is written 0 = Σj νj Bj, and in matrix form Aν = 0, where A is the conservation (or formula) matrix with elements Aij representing the number of atoms of the ith element in the jth reaction species; the stoichiometric number matrix ν "can be determined as the null space of A", and the nullity N(A) = Ns − rank(A) "gives the number of independent chemical reactions"
  2. IUPAC Commission on Isotopic Abundances and Atomic Weights (CIAAW), Standard Atomic Weights 2024 — technetium is printed with a dash rather than a value; the formula reader shared with the molar mass page refuses such elements, so they cannot be balanced here either

Related tools

Found a problem, or want more?

A number that disagrees with its source is a defect, not a rounding preference.

What did you enter, what did the tool show, and what did you expect instead? If you have a source that disagrees with ours, a link to it is the most useful thing you can send.

Write to us

Opens your mail app with the page and tool already filled in.