{
  "id": "chemical-equation-balancer",
  "version": "77795ac77570",
  "status": "published",
  "name": "Chemical Equation Balancer",
  "question": "How do I balance equations?",
  "summary": "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.",
  "category": "chemistry",
  "subcategory": "stoichiometry",
  "url": "https://www.acalculator.org/chemistry/chemical-equation-balancer",
  "markdown": "https://www.acalculator.org/chemistry/chemical-equation-balancer.md",
  "kind": "function",
  "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.",
  "assumptions": [
    "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."
  ],
  "inputs": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "eq": {
        "title": "Chemical equation",
        "description": "The unbalanced equation: formulas joined by +, with = or → between the reactants and the products.",
        "type": "string",
        "maxLength": 300
      }
    }
  },
  "outputs": {
    "balanced": {
      "label": "Balanced equation",
      "description": "The equation with the smallest whole-number coefficients (a coefficient of 1 is not written).",
      "format": "text"
    },
    "coefficients": {
      "label": "Coefficients",
      "description": "The coefficients in the order the formulas are written, left side first.",
      "format": "text"
    },
    "check": {
      "label": "Atom count",
      "description": "For each element, and the charge if any, the total on the left and on the right.",
      "format": "text"
    }
  },
  "defaultAnswer": {
    "inputs": {
      "eq": "C2H6 + O2 = CO2 + H2O"
    },
    "outputs": {
      "balanced": "2C₂H₆ + 7O₂ → 4CO₂ + 6H₂O",
      "coefficients": "2, 7, 4, 6",
      "check": "C: 4 = 4; H: 12 = 12; O: 14 = 14"
    },
    "text": "The balanced equation is 2C₂H₆ + 7O₂ → 4CO₂ + 6H₂O."
  },
  "examples": [
    {
      "given": {
        "eq": "C2H6 + O2 = CO2 + H2O"
      },
      "expect": {
        "balanced": "2C₂H₆ + 7O₂ → 4CO₂ + 6H₂O",
        "coefficients": "2, 7, 4, 6",
        "check": "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; hand calculation in content.mdx"
    },
    {
      "given": {
        "eq": "N2 + O2 → N2O5"
      },
      "expect": {
        "balanced": "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"
    },
    {
      "given": {
        "eq": "H2O -> H2 + O2"
      },
      "expect": {
        "balanced": "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"
    },
    {
      "given": {
        "eq": "Ca(OH)2 + H3PO4 = Ca3(PO4)2 + H2O"
      },
      "expect": {
        "balanced": "3Ca(OH)₂ + 2H₃PO₄ → Ca₃(PO₄)₂ + 6H₂O",
        "coefficients": "3, 2, 1, 6"
      },
      "source": "hand calculation in content.mdx: Ca 3 = 3, P 2 = 2, O 14 = 14, H 12 = 12"
    },
    {
      "given": {
        "eq": "MnO4^- + Fe^2+ + H^+ = Mn^2+ + Fe^3+ + H2O"
      },
      "expect": {
        "balanced": "MnO₄⁻ + 5Fe²⁺ + 8H⁺ → Mn²⁺ + 5Fe³⁺ + 4H₂O",
        "coefficients": "1, 5, 8, 1, 5, 4",
        "check": "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; hand calculation in content.mdx"
    },
    {
      "given": {
        "eq": "KMnO4 + HCl = KCl + MnCl2 + H2O + Cl2"
      },
      "expect": {
        "balanced": "2KMnO₄ + 16HCl → 2KCl + 2MnCl₂ + 8H₂O + 5Cl₂",
        "coefficients": "2, 16, 2, 2, 8, 5"
      },
      "source": "hand calculation in content.mdx: K 2 = 2, Mn 2 = 2, O 8 = 8, H 16 = 16, Cl 16 = 16"
    }
  ],
  "sources": [
    "OpenStax, Chemistry 2e, §4.1 Writing and Balancing Chemical Equations (Example 4.1, 2N₂ + 5O₂ ⟶ 2N₂O₅; 2C₂H₆ + 7O₂ ⟶ 6H₂O + 4CO₂). https://openstax.org/books/chemistry-2e/pages/4-1-writing-and-balancing-chemical-equations",
    "OpenStax, Chemistry 2e, §17.1 Review of Redox Chemistry (balancing redox equations, charge and atoms). https://openstax.org/books/chemistry-2e/pages/17-1-review-of-redox-chemistry",
    "Blakley, G. R. (1982). Chemical equation balancing: A general method which is quick, simple, and has unexpected applications. Journal of Chemical Education 59(9), 728. https://doi.org/10.1021/ed059p728"
  ],
  "related": [
    "molar-mass",
    "molarity",
    "dilution"
  ],
  "changelog": []
}
