Percent composition is a useful tool in the real world for determining the identities of substances. Finding mass percent from the chemical formula is explained in the video below. In the lab, a process called elemental analysis would be used to find the mass percentage and then the empirical formula process in the next section on this page would be used to find the formula.
The empirical formula is the lowest whole number ratio of elements within a compound. For binary ionic compounds, the empirical formula is the chemical formula; however, for some ionic compounds like sodium oxalate, the empirical formula is not the chemical formula. The process of finding empirical formula is very similar to the reverse of finding the percent composition. The first video shows how to get the empirical formula if given percent composition. The process is the same if you are given grams of each substance. The second video shows how empirical formula is related to molecular formula.
Molecules contain a certain number of each type of atom. Some molecules have a formula that is a whole number multiple of their empirical formula. Finding the molecular formula of a molecule will involve dividing the molar mass of the molecular formula by the molar mass of the empirical formula to find the whole-number multiple that will transform the empirical formula into the molecular formula. The first video below shows conceptually how to find the molecular formula and the second video shows how to complete a calculation to find the molecular formula if the empirical formula and molecular mass are known.