To illustrate the difference, consider the empirical formula for hydrogen peroxide: HO. The known molar mass of hydrogen peroxide is 34.0 g/mol. But the empirical formula mass is only 17.0 g/mol. That means the actual molecular formula for the compound must be H2O2 or twice the empirical formula.

Molecular formulas are either the same as the empirical formula or some integer multiple. To know whether an empirical formula is also the molecular formula you need to know the molar mass of the compound.

Examples
More examples
Still more examples...
Wait!! One more example!!!