How to write a chemical formula

A chemical formula shows which elements are in a compound and how many atoms of each, using element symbols and subscripts, like H₂O. How you write it depends on the type of compound:

Red and yellow molecular model beads connected by thin gray lines
A molecular model, the atoms and bonds a chemical formula records.Photo: andreas160578 / Pixabay
  1. 1

    Ionic: balance charges

    Total positive charge = total negative charge.

  2. 2

    Cation first

    The metal or positive ion comes first.

  3. 3

    Molecular: prefixes

    Di-, tri-, tetra- give the subscripts.

  4. 4

    Lowest ratio

    Ionic formulas use the smallest whole numbers.

Do your homework in Evernote. The AI Assistant explains any problem you photograph, step by step.

Keep your formulas in Evernote

How to write the formula of an ionic compound in 5 steps

  1. 1

    Write both ions with their charges

    Get the charge from the periodic table for main-group elements (Al³⁺, O²⁻) or from the name for transition metals (iron(III) is Fe³⁺).

  2. 2

    Find the lowest common multiple of the charges

    For +3 and −2, the LCM is 6. That is the total charge each side must reach.

  3. 3

    Work out the subscripts

    Divide the LCM by each charge: 6 ÷ 3 = 2 aluminum ions, 6 ÷ 2 = 3 oxide ions.

  4. 4

    Write the formula, cation first

    Al₂O₃. Leave out a subscript of 1. Put polyatomic ions in parentheses when you need more than one: Ca₃(PO₄)₂.

  5. 5

    Check that the charges cancel

    2 × (+3) + 3 × (−2) = 0. A neutral compound must add to zero.

Chemical formula examples

An ionic compound, a polyatomic ion and a molecular compound

Write the formulas for aluminum oxide, calcium phosphate and dinitrogen pentoxide.

  1. 1IonsAl³⁺ and O²⁻; Ca²⁺ and PO₄³⁻
  2. 2LCM3 and 2 → 6; 2 and 3 → 6
  3. 3Subscripts2 Al, 3 O; 3 Ca, 2 PO₄
  4. 4FormulasAl₂O₃; Ca₃(PO₄)₂
  5. 5Check2(+3) + 3(−2) = 0; 3(+2) + 2(−3) = 0

Al₂O₃, Ca₃(PO₄)₂, and N₂O₅ (di = 2 nitrogen, penta = 5 oxygen)

Molecular compounds of two nonmetals do not use charges: the prefixes in the name give the subscripts directly.

Common polyatomic ions

Treat each one as a single unit with one charge, and keep its formula intact.

IonFormulaExample compound
AmmoniumNH₄⁺NH₄Cl, ammonium chloride
HydroxideOH⁻Ca(OH)₂, calcium hydroxide
NitrateNO₃⁻KNO₃, potassium nitrate
CarbonateCO₃²⁻Na₂CO₃, sodium carbonate
SulfateSO₄²⁻MgSO₄, magnesium sulfate
PhosphatePO₄³⁻Ca₃(PO₄)₂, calcium phosphate

OpenStax Chemistry 2e, sections 2.6 "Ionic and Molecular Compounds" and 2.7 "Chemical Nomenclature".

Trusted by Millions Worldwide

4.4

2,100+ reviews on G2

4.4

8,200+ reviews on Capterra

4.4

73,000+ reviews on App Store

248M

Registered users

Chemical formula questions

What is a chemical formula?

A way of writing a compound with element symbols and subscripts that show how many atoms of each element it contains. H₂O has 2 hydrogen atoms and 1 oxygen atom.

What is the criss-cross method?

A shortcut for ionic formulas: the number of each ion's charge becomes the other ion's subscript. Al³⁺ and O²⁻ give Al₂O₃. Reduce to the lowest ratio afterward: Mg²⁺ and O²⁻ give MgO, not Mg₂O₂.

When do I use parentheses?

When a compound has more than one of a polyatomic ion: Mg(OH)₂ has two hydroxide ions. With only one, leave them out: NaOH.

What do the Greek prefixes mean?

In molecular compounds: mono 1, di 2, tri 3, tetra 4, penta 5, hexa 6. Carbon dioxide is CO₂; carbon monoxide is CO. Mono is left off the first element.

What is the difference between ionic and molecular compounds?

Ionic compounds are named from the cation and anion, without prefixes. Molecular compounds are two or more nonmetals, and their names use prefixes.

What is the difference between an empirical and a molecular formula?

An empirical formula gives the simplest whole-number ratio of atoms; a molecular formula gives the actual numbers. Glucose is C₆H₁₂O₆; its empirical formula is CH₂O.

How to keep your chemistry notes with Evernote

Keep a Math notebook with your chemistry formula sheet and a note for each problem you photograph.

  1. 1

    Build a formula sheet.

    Ask the AI Assistant to add the charge-balance rule to your chemistry formula sheet, with one worked example. It writes the formula in a formula block, so it reads like the textbook.

  2. 2

    Explain a problem.

    Add a photo of your chemistry problem, such as calcium phosphate, and ask the Assistant to explain it step by step. It reads the photo and adds the steps under it.

  3. 3

    Practice before the test.

    Ask the Assistant for a repeating practice task, such as 10 chemical formula problems every Tuesday and Thursday until the test. You get a reminder each time.

  • You can also search for a word in your photographed worksheets and find the page.
  • You can also draw a graph by hand in a sketch block.
  • You can also ask the AI Assistant to write practice problems from your notes, with answers.

Keep every formula and worked example in one place

Build a formula sheet, photograph a problem for a step-by-step explanation, and practice on a schedule before the test.

Start for free