1. The iconic duo
There cannot be a more iconic duo, in Chemistry at least, than the sodium ion and chloride ion in the compound sodium chloride.
The ions come in pairs. We know this from the chemical formula of NaCl, whereby the ratio of sodium ions to chloride ions is 1:1. Therefore, in terms of number of particles, 50% of the particles in the giant ionic lattice are sodium ions, while the remaining 50% are chloride ions.
2. Elements pulling their weight
There is another way to look at the composition of sodium chloride. Sodium, being the lighter element, takes up 39% of the total mass of the compound. Chlorine, the heavyweight, takes up the remaining 61% of the total mass. We call this the percentage mass of an element in a compound.
How did we get these percentages? We express the mass of all the atoms of the element we are interested in as a fraction of the total mass of the compound:
% mass of element Z = (no. of atoms of Z × A_{r} of Z) ÷ M_{r} of compound × 100%
3. Calculating percentage mass from chemical formula
Let’s practise by working with something complicated: to find the percentage mass of carbon in glucose molecule, C_{6}H_{12}O_{6}. We shall break up the above method into three separate steps:

STEP 1: Find the relative molecular mass, M_{r} of C_{6}H_{12}O_{6}
M_{r} = 6×12 + 12×1 + 6×16 = 180

STEP 2: Find the relative mass of all carbon atoms in a molecule of C_{6}H_{12}O_{6}
Relative mass of carbon in C_{6}H_{12}O_{6} = 6×12 = 72

STEP 3: Compute the percentage mass
% mass of C = (72÷180) × 100% = 40%
4. Working backwards in the laboratory to find empirical formula
If we can use the chemical formula of compounds to calculate the percentage mass of each of their constituent element, we can work backwards! In the laboratory, we can measure the percentage mass of each element to infer the chemical formula. We call this formula the empirical formula.
Yes, we heard you! What does that cheem word mean? Empirical is the opposite of theoretical. It means that the formula is our intelligent guess based on firsthand observations made in the laboratory.
To infer the empirical formula, we shall:
 Assume that you are working with a 100 g sample, express percentage mass as mass
 Convert mass into number of moles: mass ÷ molar mass = number of moles
 Divide the large number of moles by the smallest number of moles
 Find the simplest mole ratio in whole numbers
5. I spy empirically with my little eye…
Let’s say we found out from experiments that an unknown sugar has 40% carbon, 6.7% hydrogen, and 53.3% oxygen. From this, we can infer the empirical formula by following the above steps:
Carbon  Hydrogen  Oxygen  

Mass in 100 g sample/ g  40  6.7  53.3 
A_{r}  12  1  16 
No. of moles/ mol  40 ÷ 12 = 3.33  6.7 ÷ 1 = 6.7  53.3 ÷ 16 = 3.33 
Divide by smallest value  3.33 ÷ 3.33 = 1  6.7 ÷ 3.33 = 2.01  3.33 ÷ 3.33 = 1 
Simplest ratio  1  2  1 
Therefore, the empirical formula of the unknown sugar is CH_{2}O.
6. Big brain time: finding molecular formula from empirical formula
Empirical formula is the simplest ratio of elements. It may not show the actual number atoms in one molecule of the compound. In other words, for the empirical formula of CH_{2}O that we found, the actual molecular formula may be: CH_{2}O, C_{2}H_{4}O_{2}, C_{3}H_{6}O_{3}, C_{4}H_{8}O_{4}, C_{5}H_{10}O_{5}, C_{6}H_{12}O_{6}… C_{n}H_{2n}O_{n}. In other words, the molecular formula is one of the multiples of the simplest ratio of 1:2:1. We shall represent the multiple as an unknown variable, n.
To correctly identify the molecular formula is to find the value of n. We will need another piece of experimental result to do so: the relative molecular mass, M_{r}.
n × relative mass of atoms in empirical formula = actual M_{r} of compound
Given that the M_{r} of the unknown sugar is 180:

STEP 1: Find the relative mass of atoms in the empirical formula of CH_{2}O
Relative mass of atoms = 12 + 2×1 + 16 = 30

STEP 2: Given that the molecular formula is C_{n}H_{2n}O_{n}, find the value of the multiplier, n
n × 30 = 180
n = 180 ÷ 30 = 6 
STEP 3: Write the molecular formula
C_{6}H_{12}O_{6}