Skip to main content

Ion/Atom Counter (per Formula Unit) Calculator

Type a chemical formula and, if you like, the atoms or ions you want to count. You get the number in one formula unit, a full element table, a picture of how the formula is built, and every step with the multiplication shown. It understands brackets, hydrates and pasted subscripts, so formulas like Ca₃(PO₄)₂, K₄[Fe(CN)₆] and Al₂(SO₄)₃·18H₂O work as typed.

Background

A chemical formula is a compact recipe. Subscripts multiply the atom or bracket just before them, brackets group atoms that travel together as an ion, and a dot in a hydrate such as CuSO₄·5H₂O adds water molecules, with the number in front multiplying everything after it. Counting atoms or ions is just following those multipliers all the way down, and this calculator does that for you and shows its work so you can check your own.

Set up your count

Step 1 — Enter the formula

Capital letters matter (Co is cobalt, CO is carbon monoxide). Brackets ( ) [ ] { } and hydrate dots (· or .) are fine. Charges and state labels like (aq) are ignored.

Step 2 — What do you want to count? (optional)

A single symbol such as O counts atoms. Anything longer, such as PO4 or NH4, counts that ion or group. Leave it empty to see just the full breakdown.

Learning options

Result

No result yet. Enter a formula above and click Count.

How to use this calculator

  • Type one chemical formula into the first box. Hydrates, brackets and pasted subscripts such as H₂O all work.
  • In the second box, list what you want to count, separated by commas. Use a single symbol like O for atoms, or a group like PO4 or NH4 for ions. This step is optional.
  • Click Count. The result shows the total number of atoms, the count for each thing you asked about, and a table of every element.
  • Read the structure picture to see which pieces were counted, and open the step-by-step solution to check each multiplication.

How the counting works

1

A formula unit is the smallest whole-number group of atoms or ions a formula describes. For an ionic compound it is the repeating cell of the crystal, since ionic solids don't have separate molecules.

2

A number written after an element, like the 4 in O₄, multiplies that one atom. A number written after a closing bracket multiplies everything inside the bracket.

3

Multipliers stack. In Al₂(SO₄)₃, each oxygen is multiplied by 4 for the sulfate and again by 3 for the three sulfates, so there are 3 × 4 = 12 oxygen atoms.

4

A dot separates a hydrate's water from the main compound. A number just after the dot multiplies the whole water molecule, so ·18H₂O adds 18 × 2 = 36 hydrogen and 18 × 1 = 18 oxygen atoms.

5

To count an element, add up every place it appears, including inside brackets and in the hydrate water. That is why oxygen in Al₂(SO₄)₃·18H₂O is 12 + 18 = 30.

6

To count an ion or group, the calculator looks for it as a unit: a whole bracket, or neighboring atoms with exactly the right counts, such as the S and O₄ side by side in K₂SO₄. Atoms are matched within one bracket or hydrate part, so water oxygen is never mistaken for part of a hydroxide.

7

Charges are not part of the counting. SO₄²⁻ has 5 atoms whatever its charge, so the charge is ignored when you type it.

Counting rules used

Atoms of an element: sum of (coefficient × bracket multipliers × subscript) over every place the element appears

Atoms inside nested brackets: outer multiplier × inner multiplier × subscript

Hydrate water: coefficient × subscripts of H₂O, added to the main compound's counts

Total atoms per formula unit: sum of all element counts

Ions or groups: number of matching units × the multipliers of the brackets they sit in

Example Problems & Step-by-Step Solutions

Example 1 — Phosphate in calcium phosphate

Count PO₄, Ca and O in Ca₃(PO₄)₂.

Step: The bracket (PO₄)₂ holds one phosphate and is multiplied by 2. Ca has a subscript of 3. Oxygen is 4 × 2 = 8.

Result: 2 phosphate ions, 3 Ca and 8 O. Altogether 3 + 2 + 8 = 13 atoms per formula unit.

Example 2 — Oxygen in a hydrate

Count SO₄ and O in Al₂(SO₄)₃·18H₂O.

Step: Sulfate: (SO₄)₃ gives 3 ions. Oxygen in sulfate is 3 × 4 = 12. Oxygen in the water is 18 × 1 = 18 (each H₂O has one oxygen).

Result: 3 sulfate ions and 12 + 18 = 30 oxygen atoms. Hydrogen is 18 × 2 = 36, so there are 71 atoms in total.

Example 3 — Square brackets

Count CN and K in K₄[Fe(CN)₆].

Step: The square bracket holds one Fe and (CN)₆, which is six cyanide groups. K has a subscript of 4.

Result: 6 cyanide ions and 4 K. Carbon is 6 and nitrogen is 6, giving 17 atoms in all.

Example 4 — Two ions at once

Count NH₄ and SO₄ in (NH₄)₂SO₄.

Step: The bracket (NH₄)₂ gives 2 ammonium ions. The SO₄ at the end isn't in a bracket, but S and O₄ sit side by side, so it is found as one sulfate.

Result: 2 ammonium and 1 sulfate. Atoms: N 2, H 8, S 1, O 4, total 15.

Example 5 — Hydroxide or hydrate water?

Count OH, H and O in Ba(OH)₂·8H₂O.

Step: (OH)₂ is two hydroxide ions. The 8 H₂O molecules are separate water, so their atoms are not hydroxide even though they contain O and H.

Result: 2 hydroxide ions, O = 2 + 8 = 10, H = 2 + 16 = 18, total 29 atoms.

Example 6 — Copper sulfate pentahydrate

Count O and H₂O in CuSO₄·5H₂O.

Step: Oxygen is 4 in the sulfate plus 5 × 1 in the water. The water appears as 5 molecules after the dot.

Result: O = 4 + 5 = 9 and 5 water molecules. Hydrogen is 5 × 2 = 10, so 21 atoms in total.

Example 7 — An ion with no brackets

Count SO₄ and K in K₂SO₄.

Step: There are no brackets here, so the calculator looks for neighbors. S followed by O₄ has exactly the right counts for one sulfate.

Result: 1 sulfate and 2 K, which is 7 atoms per formula unit.

Example 8 — Acetate written atom by atom

Count C₂H₃O₂ and C in Ca(CH₃COO)₂.

Step: The bracket holds C, H₃, C, O, O, which totals C₂H₃O₂ however it is written. It is multiplied by 2. Carbon is 2 × 2 = 4.

Result: 2 acetate ions and 4 C. Atoms: Ca 1, C 4, H 6, O 4, total 15.

Frequently Asked Questions

Does it handle hydrates like CuSO₄·5H₂O?

Yes. Use a middle dot (·) or a period. Each part is read on its own and the number in front of the water multiplies all of its atoms.

What does “per formula unit” mean?

A formula unit is the smallest whole-number group of atoms or ions a formula describes. The counter gives the totals inside one such unit, for example 13 atoms in one Ca₃(PO₄)₂.

Can I count any ion or group?

Yes. Type it into “What to count”, for example PO4, NO3, NH4, OH or even Fe(CN)6. It is counted when it appears as a whole bracket or as neighboring atoms with exactly the right counts.

Why did my ion count come out as 0?

The ion has to appear as a unit in the formula. A group that is spread out is not counted. For example, OH in H₂SO₄ gives 0: the H and O atoms are there, but the H is written first and the O atoms sit inside the SO₄, so no OH unit appears. The result explains whether the atoms are missing altogether or just not together.

Why isn't water's oxygen counted as hydroxide?

Atoms are matched inside one bracket or hydrate part, never across them. In Ba(OH)₂·8H₂O only the (OH)₂ is hydroxide, so the answer is 2, not 10, even though the water also contains O and H.

Can I paste subscripts, charges or square brackets?

Yes. Pasted subscripts like H₂O, square and curly brackets, and charges such as SO₄²⁻ or SO4^2- are all understood. Charges and state labels like (aq) are ignored because they don't change the atom count.

What if I type the formula in lowercase?

If there is only one sensible reading, such as nacl for NaCl, it is used and you are told. If there are several, such as co2 for CO₂ or Co₂, you are offered the choices, because capital letters decide which element you mean.

Can I enter a reaction equation?

No. This calculator counts atoms in one formula at a time, so enter each species separately. To balance a whole equation, use the Balance Chemical Equation Calculator.

Back to all calculatorsAll calculators