The balancing numbers in an equation can be worked out from the masses of the reactants and products. Convert each mass in grams to an amount in moles using moles = mass ÷ relative formula mass. The balancing numbers are in the same ratio as the moles.
To get simple numbers, divide every number of moles by the smallest one. This gives a simple whole number ratio.
Example: 4.8 g of magnesium (Ar = 24) reacts with 3.2 g of oxygen (Mr = 32) to make 8.0 g of magnesium oxide (Mr = 40). The moles are 4.8 ÷ 24 = 0.2 mol of Mg, 3.2 ÷ 32 = 0.1 mol of O2 and 8.0 ÷ 40 = 0.2 mol of MgO. Dividing by 0.1 gives the ratio 2 : 1 : 2. So the balanced equation is 2Mg + O2 → 2MgO.
If the ratio is not whole numbers, such as 1 : 1.5, every number is multiplied by 2 to give 2 : 3. The whole numbers are then used as the balancing numbers.