Chemical Equation Balancer Calculator
Type an unbalanced chemical equation using element symbols and this tool will find the smallest whole-number coefficients that satisfy conservation of mass for every element.
How does this calculator work?
Enter an equation like "CH4 + O2 = CO2 + H2O" and the balancer solves the atom-conservation matrix A·x = 0 (x > 0) by Gaussian elimination over rationals, then scales to smallest integers. Result: CH₄ + 2O₂ → CO₂ + 2H₂O. Works for reactions where the null space of the element matrix is one-dimensional.
Formula
How this is calculated
For a chemical equation with N compounds and M distinct elements, balancing reduces to finding a positive integer vector x of length N such that the element matrix equation A·x = 0 holds — where A[i][j] is the count of element i in compound j (positive for reactants, negative for products). This is equivalent to finding the null space of A.
The calculator uses rational Gaussian elimination (Gauss–Jordan RREF over the field of fractions). It sets the coefficient of the last compound to 1 (a free variable), which determines the remaining N−1 unknowns from the M linear element-balance equations. The fractional solution is then scaled by the least common multiple of the denominators to produce the smallest positive integer coefficients. If the system is inconsistent (no valid balance) or all coefficients cannot be made positive, a "cannot balance" message is shown.
The method works for any simple reaction where the null space of A is one-dimensional — which covers the vast majority of reactions encountered in general chemistry. Reactions with multiple independent balance modes (e.g., disproportionation reactions with two free variables) will not be resolved automatically. Limitations: subscripts beyond parentheses are not supported (e.g., CaCO₃·5H₂O dots, ionic charges, or bracket notation). Enter up to 8 compounds total.
Frequently asked questions
Balancing by inspection ("trial and error") works by adjusting coefficients until atoms count on both sides. Algebraic balancing sets up a system of linear equations — one per element — and solves them simultaneously using matrix methods. The algebraic approach always finds the answer in a finite number of steps and handles complex reactions (many elements and compounds) that are impractical to balance by inspection alone.
Stoichiometric coefficients represent mole ratios — the number of moles of each substance that react or form. Moles are a counting unit, and ratios must be expressible as simple integers for practical use. Mathematically, the null-space solution contains any scaling; we choose the smallest positive integer scaling so that coefficients like "1, ½, 1" become "2, 1, 2".
The balancer treats element symbols only, so SO₄ in a formula like H₂SO₄ is parsed as {H:2, S:1, O:4}. Full polyatomic ions with explicit charges are not supported, but writing their formulas with element symbols and subscripts works correctly for most acid-base and redox equations. Hydrates (CuSO₄·5H₂O notation) and square brackets are not supported — write the explicit formula instead.
TG we-Calculate Editorial Team. (2026). Chemical Equation Balancer Calculator [Online calculator]. TG we-Calculate. https://we-calculate.com/calculator/chemical-equation-balancer-calculator
TG we-Calculate Editorial Team. "Chemical Equation Balancer Calculator." TG we-Calculate. 2026. https://we-calculate.com/calculator/chemical-equation-balancer-calculator.
TG we-Calculate Editorial Team, "Chemical Equation Balancer Calculator," TG we-Calculate, 2026. [Online]. Available: https://we-calculate.com/calculator/chemical-equation-balancer-calculator
@misc{wecalculate_chemical_equation_balancer_calculator, title = {Chemical Equation Balancer Calculator}, author = {{TG we-Calculate Editorial Team}}, howpublished = {\url{https://we-calculate.com/calculator/chemical-equation-balancer-calculator}}, year = {2026}, note = {TG we-Calculate} }
Did this calculator help you?
