acalculator

How do I balance equations?

Type an unbalanced equation such as C2H6 + O2 = CO2 + H2O. The balancer finds the smallest whole-number coefficients and shows that every atom matches.

Your numbers

Write charges with a caret, such as Fe^3+ or OH^-.
Balanced equation
2C₂H₆ + 7O₂ → 4CO₂ + 6H₂O

The balanced equation is 2C₂H₆ + 7O₂ → 4CO₂ + 6H₂O.

Coefficients
2, 7, 4, 6
Atom count
C: 4 = 4; H: 12 = 12; O: 14 = 14

Balanced equation: 2C₂H₆ + 7O₂ → 4CO₂ + 6H₂O. The balanced equation is 2C₂H₆ + 7O₂ → 4CO₂ + 6H₂O.

Do the atoms match?

How to calculate

Balances a chemical equation, including ionic equations with charges, by finding the smallest whole-number coefficients that make every element and the charge match on both sides.

Example with the default inputs (Chemical equation C2H6 + O2 = CO2 + H2O): The balanced equation is 2C₂H₆ + 7O₂ → 4CO₂ + 6H₂O.

Method: For each element (and the charge), Σ coefficient × atoms on the left = Σ coefficient × atoms on the right; the coefficients are the smallest positive whole-number solution of these equations, found by exact row reduction.

  • The equation must balance in exactly one way (one free direction), with every coefficient above 0.
  • Coefficients typed in front of formulas are ignored; the calculator finds its own.
  • Charges count as one more quantity to balance, so ionic and redox equations work. Electrons can be written as e or e^-.
  • Formulas follow the same rules as the molar mass calculator: brackets, hydrate dots, subscripts, and phase labels such as (aq), which are shown but not counted.

Machine-readable copies: Markdown, JSON.

Worked examples

Each example is checked against the calculator on every build.

  1. Chemical equation C2H6 + O2 = CO2 + H2O gives Balanced equation 2C₂H₆ + 7O₂ → 4CO₂ + 6H₂O, Coefficients 2, 7, 4, 6, Atom count C: 4 = 4; H: 12 = 12; O: 14 = 14.Source: OpenStax, Chemistry 2e, §4.1 Writing and Balancing Chemical Equations (balance by atom counts), https://openstax.org/books/chemistry-2e/pages/4-1-writing-and-balancing-chemical-equations
  2. Chemical equation N2 + O2 → N2O5 gives Balanced equation 2N₂ + 5O₂ → 2N₂O₅, Coefficients 2, 5, 2.Source: OpenStax, Chemistry 2e, §4.1, Example 4.1 (2N₂ + 5O₂ ⟶ 2N₂O₅), https://openstax.org/books/chemistry-2e/pages/4-1-writing-and-balancing-chemical-equations
  3. Chemical equation H2O -> H2 + O2 gives Balanced equation 2H₂O → 2H₂ + O₂, Coefficients 2, 2, 1.Source: OpenStax, Chemistry 2e, §4.1 (the decomposition of water, 2H₂O ⟶ 2H₂ + O₂), https://openstax.org/books/chemistry-2e/pages/4-1-writing-and-balancing-chemical-equations
  4. Chemical equation Ca(OH)2 + H3PO4 = Ca3(PO4)2 + H2O gives Balanced equation 3Ca(OH)₂ + 2H₃PO₄ → Ca₃(PO₄)₂ + 6H₂O, Coefficients 3, 2, 1, 6.
  5. Chemical equation MnO4^- + Fe^2+ + H^+ = Mn^2+ + Fe^3+ + H2O gives Balanced equation MnO₄⁻ + 5Fe²⁺ + 8H⁺ → Mn²⁺ + 5Fe³⁺ + 4H₂O, Coefficients 1, 5, 8, 1, 5, 4, Atom count Mn: 1 = 1; O: 4 = 4; Fe: 5 = 5; H: 8 = 8; charge: +17 = +17.Source: OpenStax, Chemistry 2e, §17.1 Review of Redox Chemistry (balancing redox equations by half-reactions), https://openstax.org/books/chemistry-2e/pages/17-1-review-of-redox-chemistry
  6. Chemical equation KMnO4 + HCl = KCl + MnCl2 + H2O + Cl2 gives Balanced equation 2KMnO₄ + 16HCl → 2KCl + 2MnCl₂ + 8H₂O + 5Cl₂, Coefficients 2, 16, 2, 2, 8, 5.

How it works

Write one unknown coefficient for each formula. For every element, the atoms must match:

Σ (coefficient × atoms of the element) on the left = Σ (coefficient × atoms of the element) on the right

If any formula has a charge, the total charge must match the same way. These are linear equations with whole-number entries. The balancer puts them in a matrix (one row per element, then the charge; one column per formula, left side positive, right side negative) and finds its null space exactly by row reduction in fractions:

  • If there is exactly one free direction, the coefficients are that solution scaled to the smallest whole numbers with no common factor, the first one positive.
  • If every coefficient is then above 0, that is the answer.

Reading the equation

  • One arrow between the sides: =, →, ->, =>, ⇒, ⟶, ⇌, ↔, <=> or <->. None or more than one gives no answer: "Write the equation with one = or → between the reactants and the products."
  • Formulas on each side are joined by +. A + that is part of a charge (Fe^3+) does not split formulas.
  • Each formula is read as on the molar mass calculator: element symbols start with a capital letter; numbers after a symbol or a closing bracket are counts; ( ) and [ ] group atoms; a dot (·, •, ., or *) starts a hydrate part whose leading number multiplies it; subscript digits read as digits; spaces are ignored.
  • A number in front of a formula is ignored: the balancer finds its own coefficients.
  • A charge goes at the end, with a caret (Fe^3+, OH^-, SO4^2-) or in superscripts (Fe³⁺). An electron is e, e-, e^- or e⁻ (a number in front, such as 6e^-, is ignored like any coefficient), with a charge of −1 and no atoms.
  • A phase label at the end, (s), (l), (g) or (aq), is kept in the answer but not counted.

When there is no answer

  • An element on only one side: "X appears only on the left side, so the equation cannot be balanced." (or right side).
  • No solution other than all zeros: "No whole numbers balance this equation. Check the formulas and which side each one is on."
  • More than one free direction: "This equation balances in more than one way, because it combines separate reactions. Balance each reaction on its own."
  • A solution that needs a coefficient of 0 or below: "No balance has every coefficient above 0: a formula may be on the wrong side, or may not take part."
  • A formula that cannot be read gives its own message (an unknown element symbol, brackets that do not match, a small first letter, an empty side).

What the balancer shows

  • Balanced equation: the formulas in the order typed, each with its coefficient in front (a coefficient of 1 is not written), joined by " + ", with " → " between the sides. Counts are written as subscript digits, hydrates with a raised dot (·), charges as superscripts (⁺, ⁻, ²⁺, ³⁻), and phase labels in small letters.
  • Coefficients: the coefficients in order, left side first, joined by ", ".
  • Atom count: for each element in the order it first appears, <symbol>: <total on the left> = <total on the right>, and then, if any formula has a charge, charge: <left> = <right> with a sign (+17, -1, +0), joined by "; ".

Worked examples by hand

C2H6 + O2 = CO2 + H2O. Call the coefficients a, b, c, d. Carbon: 2a = c. Hydrogen: 6a = 2d. Oxygen: 2b = 2c + d. Take a = 2: c = 4, d = 6, and 2b = 8 + 6 = 14, so b = 7. 2C₂H₆ + 7O₂ → 4CO₂ + 6H₂O; C: 4 = 4; H: 12 = 12; O: 14 = 14.

N2 + O2 → N2O5. Nitrogen: 2a = 2c; oxygen: 2b = 5c. Take c = 2: a = 2, b = 5. 2N₂ + 5O₂ → 2N₂O₅.

H2O -> H2 + O2. Hydrogen: 2a = 2b; oxygen: a = 2c. Take c = 1: a = 2, b = 2. 2H₂O → 2H₂ + O₂.

Ca(OH)2 + H3PO4 = Ca3(PO4)2 + H2O. Calcium: a = 3c; phosphorus: b = 2c; take c = 1, so a = 3, b = 2. Hydrogen: 2a + 3b = 2d, so 6 + 6 = 2d and d = 6. Oxygen: 2a + 4b = 8c + d gives 6 + 8 = 8 + 6. 3Ca(OH)₂ + 2H₃PO₄ → Ca₃(PO₄)₂ + 6H₂O.

MnO4^- + Fe^2+ + H^+ = Mn^2+ + Fe^3+ + H2O. Manganese: a = d; oxygen: 4a = f; iron: b = e; hydrogen: c = 2f; charge: −a + 2b + c = 2d + 3e. Take a = 1: d = 1, f = 4, c = 8, and −1 + 2b + 8 = 2 + 3b gives b = 5 = e. MnO₄⁻ + 5Fe²⁺ + 8H⁺ → Mn²⁺ + 5Fe³⁺ + 4H₂O, with a charge of +17 on each side.

KMnO4 + HCl = KCl + MnCl2 + H2O + Cl2. Potassium: a = c; manganese: a = d; oxygen: 4a = e; hydrogen: b = 2e; chlorine: b = c + 2d + 2f. Take a = 2: c = 2, d = 2, e = 8, b = 16, and 16 = 2 + 4 + 2f gives f = 5. 2KMnO₄ + 16HCl → 2KCl + 2MnCl₂ + 8H₂O + 5Cl₂.

Other questions people ask

How do I balance a chemical equation?

Put a number (a coefficient) in front of each formula so that every element has the same number of atoms on both sides. For ethane burning, C2H6 + O2 → CO2 + H2O, the smallest whole numbers are 2C2H6 + 7O2 → 4CO2 + 6H2O: 4 carbon, 12 hydrogen and 14 oxygen atoms on each side.

How does the balancer find the coefficients?

Each element gives one equation: coefficient × atoms added up on the left = the same on the right. The balancer solves these equations exactly by row reduction and scales the answer to the smallest whole numbers. It does not guess, so the answer is always checked.

Can it balance ionic and redox equations?

Yes. Write charges with a caret, such as Fe^2+, MnO4^- or H^+. The total charge then has to match too: MnO4^- + Fe^2+ + H^+ = Mn^2+ + Fe^3+ + H2O balances to MnO4⁻ + 5Fe²⁺ + 8H⁺ → Mn²⁺ + 5Fe³⁺ + 4H₂O, with a charge of +17 on each side.

How do I type the equation?

Join formulas with +, and put =, →, -> or ⇌ between the two sides. Element symbols start with a capital letter. Brackets like Ca(OH)2, hydrates like CuSO4·5H2O (or CuSO4*5H2O), and phase labels like (aq) or (g) are fine. Numbers you type in front of formulas are ignored.

Why does it say the equation cannot be balanced?

Usually a formula is wrong, or an element is only on one side, as in H2 + O2 = H2O2 + N2. If no whole numbers make the atoms match, check the formulas and which side each one is on.

Why does it say there is more than one way to balance it?

The equation combines reactions that can run in any mix, so many sets of coefficients work, for example H2 + O2 + N2 = H2O + NH3. Balance each reaction on its own, such as 2H2 + O2 → 2H2O and N2 + 3H2 → 2NH3.