In a chemical reaction, mass is always conserved - no atoms are created or destroyed, only the bonds between atoms change
Balancing a chemical equation
Ensure the number of atoms of each element is the same on both sides of the equation
Comparing total relative formula masses of reactants and products
They are equal, demonstrating conservation of mass
When a reaction involves a gas, the mass may appear to change because the gas can come from or float off into the air and not be measured
Heating magnesium and it reacting with oxygen
The mass of the product (magnesium oxide) is greater than the mass of the reactant (magnesium)
If the experiment is done in a sealed container, the mass of the reactants and products will balance perfectly because the gaseous reactants and products are trapped
Decomposing calcium carbonate to calcium oxide and carbon dioxide
The mass of the products appears decreased because the carbon dioxide gas floats off
Doing experiments in a sealed container avoids the issue of gases escaping and affecting the apparent mass