The #"empirical formula"# is the simplest whole number ratio that defines constituent atoms in a species. Most of the time, at least for organic compounds, this can be determined from combustion analysis, where a known mass of sample is combusted with oxygen in a furnace, and the combustion products, #CO_2(g)#, #H_2O(g)#, and #NO_2(g)# are shunted to a gas chromatograph (sometimes #NO_2# is reduced back to #N_2#). When these readings are compared to a standard, very accurate percentage compositions with respect to #C,H,# and #N# may be measured.
These may then used to give the #"empirical formula"#. And then, provided that some means exist to interrogate the molecular mass of the compound is available, finally the molecular formula may be obtained in that............
#"molecular formula"=nxx"{empirical formula}"#........where #n# is generally a whole number, #1#, #2#, etc.
See here for some examples.