A chemical formula is a description which tells the number and type of each element in a compound. A chemical formula consists of the symbols of each element in a compound each followed by the number of that type of element in a subscript. For example, methane is composed of one carbon atom (symbol C) and four hydrogen atoms (symbol H). Methane's chemical formula is thus CH4.
The order of the elements in the chemical formula is sometimes written in such a way to clarify the structure of the chemical compound. For example, take a molecule which has two carbon atoms, six hydrogen atoms and one oxygen atom. The chemical formula could be written as C2H6O, however this does not clarify the structure of the molecule. C2H5OH lets the chemist know that there is a hydroxyl group, OH in the molecule. Now the chemist knows that the compound is an alcohol, ethanol. To clarify the structure even more, it could be written as CH3CH2OH, to show that three hydrogens are bonded to the first carbon, which is itself bonded to a second carbon. The second carbon is bonded to two hydrogens and a hydroxyl group.
The molecular formula is the chemical formula that indicates the actual numbers and types of atoms in a molecule.
The molecular formula of ethanol
The empirical formula is the chemical formula that gives only the relative number of atoms of each type in a molecule.
The empirical formula of ethylene
The molecular formula of ethylene