Element symbols use a capital letter and sometimes a lower-case second letter: C,O,H, Na and Cl. Case matters: Co is cobalt, while CO contains carbon and oxygen. In a molecular formula, each subscript counts atoms of the preceding element. No subscript means one.
H2O has two hydrogen atoms and one oxygen atom per molecule. CO2 has one carbon and two oxygen atoms. Multiply per-molecule counts by the number of molecules for a sample total. Some compounds form extended structures rather than discrete molecules: solid NaCl gives a sodium-to-chlorine ratio, so not every formula should be called a molecule.
Example 1
How many oxygen atoms are represented by three CO2 molecules?
Each molecule has two oxygen atoms, so 3×2=6 oxygen atoms.
Example 2
How many atoms are in one NH3 molecule?
One nitrogen plus three hydrogen atoms gives 4 atoms in total.
Watch out: No subscript means one atom of that element in the stated molecular formula.