Using the molar mass of each component of the molecule, multiply it by the percentage you are given for how much of the total mass of the molecule that component takes up. Then, divide all the components by the lowest mass you got (it should come out to simple whole numbers) and then write out the molecule with those numbers as the subscripts.
The definition of an empirical formula is: a formula giving the proportions of the elements present in a compound but not the actual numbers or arrangement of atoms. (from Google) This means that if you have the molecular formula you just need to divide by the biggest common denominator and then you have the empirical formula.
However, most problems that I have encountered you are given a certain percentage of the mass each component takes up and then you're asked to find the empirical formula. Do what I wrote above. If you don't get simple whole numbers for the subscripts you are most likely wrong. However, it can happen when you get thirds. That just means that the ratio between the lowest mass you found and that component is 2:3 or 2:4 (depending on the answer you get, if you get 4/3 then its 2:3, if its 5/3 then its 2:4, the set of numbers being the coefficients). This works because it finds the ratios between the components, which is what an empirical formula is, the ratio between each element in a compound.