Chemical Equation Balancer
Enter an unbalanced equation → get the smallest whole-number coefficients → verify every atom. Exact linear algebra, no trial and error.
Balanced equation
4 Fe + 3 O₂ → 2 Fe₂O₃
✓ BalancedCoefficient ratio: 4 : 3 : 2
Atom conservation
| Element | Reactants | Products | Status |
|---|---|---|---|
| Fe | 4 | 4 | ✓ match |
| O | 6 | 6 | ✓ match |
Exact integer arithmetic throughout. No floating-point rounding. Only coefficients change; subscripts are never touched.
How it works
From equation to balanced ratio
Split the sides
Divide reactants from products at the arrow, then split each side on +.
Parse every formula
Count atoms per species with the shared formula parser (groups, brackets, hydrates included).
Solve the conservation system
Build an exact conservation matrix and find its nonzero null-space vector.
Reduce and verify
Scale to the smallest positive whole-number ratio, then independently re-check every element.
What is a chemical equation balancer?
A chemical equation balancer finds the numbers that go in front of each formula so that every element appears the same number of times on both sides of a reaction.
For example, Fe + O2 -> Fe2O3 becomes 4 Fe + 3 O₂ → 2 Fe₂O₃. Only these leading numbers, called coefficients, ever change. The formulas themselves stay exactly as written.
Coefficients change. Subscripts never do.
Balancing only puts numbers in front of formulas. Changing a subscript changes the substance itself: H₂O is water, H₂O₂ is hydrogen peroxide. Turning H₂O → H₂O₂ to “make the atoms match” is not balancing. It is inventing a different chemical.
The balancer never changes chemical formulas or subscripts. It only solves for coefficients.
Concepts
Write equations like a chemist
Arrows and plus signs
->, →, = and => all separate reactants from products; + separates species. Both sides are required. H₂ + O₂ alone is incomplete.
Coefficients are optional
Enter 2H2 + O2 -> 2H2O or plain H2 + O2 -> H2O. Supplied numbers are never trusted and the smallest ratio is always recalculated.
Groups, hydrates, states
Parentheses ( ), brackets [ ], nested groups, hydrates like CuSO₄·5H₂O, and state labels (s) (l) (g) (aq) are all understood. Symbols stay case-sensitive: Co is cobalt, CO is carbon monoxide.
Examples
Worked examples
| Unbalanced | Balanced | Demonstrates |
|---|---|---|
| Fe + O2 -> Fe2O3 | 4 Fe + 3 O₂ → 2 Fe₂O₃ | Classic metal oxidation |
| H2 + O2 -> H2O | 2 H₂ + O₂ → 2 H₂O | Diatomic gases |
| CH4 + O2 -> CO2 + H2O | CH₄ + 2 O₂ → CO₂ + 2 H₂O | Combustion |
| Ca(OH)2 + H3PO4 -> Ca3(PO4)2 + H2O | 3 Ca(OH)₂ + 2 H₃PO₄ → Ca₃(PO₄)₂ + 6 H₂O | Parentheses |
| KClO3 -> KCl + O2 | 2 KClO₃ → 2 KCl + 3 O₂ | Decomposition |
| CuSO4·5H2O -> CuSO4 + H2O | CuSO₄·5H₂O → CuSO₄ + 5 H₂O | Hydrate |
Version 1 scope: atom conservation only
Version 1 balances equations using atom conservation only. Charged species are rejected; charge conservation and redox balancing are reserved for a later version. The engine is architected so charge becomes one more conservation row when they arrive.
FAQ
Frequently asked questions
What does it mean for an equation to be balanced?
Every element appears the same number of times on both sides. Atoms are conserved because atoms are neither created nor destroyed in a chemical reaction. The verification table above the fold proves it for each element.
Why can only coefficients change, not subscripts?
Coefficients say how many molecules react; subscripts define which substance it is. H₂O (water) and H₂O₂ (hydrogen peroxide) are different chemicals, so editing a subscript to force a match fakes the chemistry.
How do I enter an equation?
Type plain text with numbers for subscripts: Fe + O2 -> Fe2O3. Unicode subscripts (H₂O), parentheses, brackets, hydrates, and state labels like (g) all work. Arrows ->, →, =, => are accepted.
Why is “H2 + O2” alone not enough?
Balancing compares reactants against products, so both sides plus an arrow are required (e.g. H2 + O2 -> H2O). Products are never guessed. Inferring a missing product would be inventing chemistry.
Are my own coefficients trusted?
No. You may enter them, but the engine always recalculates the smallest positive whole-number ratio from scratch. 2H2 + O2 -> 2H2O and H2 + O2 -> H2O both yield 2 : 1 : 2.
Is this just trial and error?
No. Atom conservation is a linear system solved exactly with BigInt rational arithmetic (Gauss–Jordan null space), then reduced to the smallest integer ratio and verified independently. The same input always gives the same output.
Can it balance ionic or redox equations?
Not in this version: every species must be neutral, and charged input is rejected with an explicit message rather than silently ignored. Charge conservation, half-reactions, and acidic/basic redox are architected as the next phase.
What if my equation cannot be balanced?
You get a specific error, never a fudged result. Common causes: an element missing on one side, a typo in a formula (Co vs CO), or an underdetermined equation, which has valid solutions but no unique smallest ratio.