Skip to main content

Chemical Equation Balancer

Type a chemical equation the way it appears in a textbook — without coefficients — and this tool finds the smallest whole numbers that make every element (and every charge) match on both sides. H2 + O2 -> H2O becomes 2H2 + O2 → 2H2O, and the check table underneath proves it: 4 hydrogens and 2 oxygens on each side.

The parser reads real formula notation: parentheses and square brackets for groups, a middle dot for hydrates, and ion charges — Fe3+, SO42-, or with a caret, Fe^3+. And it refuses honestly: an equation with no balance, more than one balance, or a formula it cannot read gets a plain explanation, never a wrong answer.

Reactants + products, joined by -> or =. Type it WITHOUT coefficients — balancing is this tool's job. Parentheses, square brackets, hydrates (·) and ion charges all work.

Balanced equation

2H2 + O2 → 2H2O

Coefficients of 1 are left out, as chemists write them.

ElementLeft sideRight sideMatch
H44✓
O22✓

How it is worked out

  1. Each side parses to atom counts — e.g. H2 contributes 2 × H; O2 contributes 2 × O; H2O contributes 2 × H, 1 × O.
  2. The element matrix (reactants negative, products positive) is solved exactly over rationals; the null space is one-dimensional, so the balance is unique up to scale.
  3. Scaling to the smallest whole numbers gives 2, 1, 2 — and the check table below proves every element (and charge, where present) matches on both sides.

Embed this calculator on your website →

The formula

aA + bB → cC + dD, with atoms in = atoms out, for every element

  • The matrix — each element is a row, each species a column, reactants negative and products positive. The balance is the matrix’s null space, solved exactly over rationals — no floating-point guessing, so a coefficient is right or the equation is refused.
  • Uniqueness — a balance counts only when the null space is one-dimensional and every coefficient is positive. C + O2 → CO + CO2 is refused: two independent balances fit it, so no single answer exists.
  • Charge — when any species carries a charge, charge is conserved as an extra matrix row. Fe3+ + 3OH- → Fe(OH)3 balances in charge as well as atoms.

Worked example: methane burning, CH4 + O2 → CO2 + H2O: carbon needs 1 → 1, hydrogen needs 4 → 2 waters, and those 2 waters plus the CO2 need 4 oxygens → 2 O2. Answer: CH4 + 2O2 → CO2 + 2H2O.

How it works

Why balancing is bookkeeping, not chemistry. A reaction rearranges atoms; it never creates or destroys them. The coefficients are simply the smallest whole numbers that make that bookkeeping come out even — which is why balancing is pure linear algebra, and why a tool that guesses with decimals will eventually hand you a coefficient like 1.9999999. This one solves exactly and scales to integers, so the answer is always clean.

Hydrates count in full. CuSO4·5H2O heated gives CuSO4 + 5H2O — the five waters are real molecules leaving the crystal, not decoration. The parser multiplies a hydrate segment’s coefficient across its whole segment, the same rule the Molecular Weight Calculator uses, so the two tools can never disagree about what CuSO4·5H2O contains.

What it will not do. Half-reactions with free electrons (e-) are refused with an explanation: electrons are bookkeeping for redox steps, not species in a full reaction. Equations with typed coefficients are refused too — if you already know the coefficients, there is nothing to balance; type the bare equation and let the tool do its one job.

Examples

  • Rust — Fe + O2 → Fe2O3 balances as 4Fe + 3O2 → 2Fe2O3.
  • Permanganate titration — KMnO4 + HCl → KCl + MnCl2 + Cl2 + H2O balances as 2KMnO4 + 16HCl → 2KCl + 2MnCl2 + 5Cl2 + 8H2O, with 16 chlorines on each side to prove it.
  • Ionic precipitation — Ba2+ + SO42- → BaSO4 is already 1 : 1 : 1, charges included.
  • Acid on limestone’s cousin — Ca(OH)2 + HCl → CaCl2 + H2O balances as Ca(OH)2 + 2HCl → CaCl2 + 2H2O.

Frequently asked questions

How do I write charges — is SO42- sulfate or S + O42?

SO42- is sulfate, SO4 with a −2 charge. The charge rules are: a caret is unambiguous (Fe^3+, O2^-); a lone element's digits are its charge (Fe3+, O2- as the oxide ion); and a trailing digit-run of two or more digits splits, its last digit being the charge (SO42-, Cr2O72-, Fe(CN)64-). A single trailing digit stays a subscript, so NH4+ is NH4 with +1 and H3O+ is H3O with +1. Anything ambiguous should be written with a caret — O2^- is superoxide, O2^2- is peroxide.

Why was my equation refused instead of balanced?

Four honest reasons, and the message names which one: a formula the parser cannot read (unknown element, unbalanced bracket, stray count); a typed coefficient (type the bare equation); no balance with all positive coefficients (one species does not belong, or a formula is mistyped — H2 + O2 -> H2O + CO2 fails because carbon appears on one side only); or more than one independent balance fits (C + O2 -> CO + CO2), so no single answer exists. A refusal is the tool doing its job — a guessed balance would be worse than none.

Do I need subscripts or special characters?

No — plain text is the input. Type H2O, not H₂O; type -> or = for the arrow (a → also works); type CuSO4·5H2O for hydrates, where the middle dot can also be typed as * or . if your keyboard lacks it. Parentheses and square brackets both group: Ca(OH)2 and Ca[OH]2 mean the same thing here.

How is this different from the Molecular Weight Calculator?

That tool weighs one formula: it counts the atoms in CuSO4·5H2O and returns its molar mass. This tool balances a reaction: it finds the coefficients that make atoms match across an arrow. They share the same formula parser and the same element table, so they can never disagree about what a formula contains — but they answer different questions, and neither replaces the other.