The chemical formula describes the composition of compounds and elements.
Lets look at the basic stuff first. Elements are composed of one type of atom.
Oxygen is composed of 2 bonded oxygen molecules. This means it’s chemical formula is O2.
The Display formula shows the amount of atoms, plus the amount of covalent bonds between them (number of lines).
The two oxygen atoms share 2 electrons, thus there are 2 lines.
Now, lets look at a simple compound.
Water is a compound because it is made up of one Oxygen (O) and two hydrogen (H) which are chemically bonded.
Water is H2O
Oxygen only shares one electron with each hydrogen, so there is only one line per hydrogen
By now you have noticed the numbers after the letters. A small number after the letter tells us how much of that specific atom is in the molecule.
Lets look at another compound.
Glucose
The chemical equation here is C6H12O6. This means there are 6 carbon, 12 Hydrogen and 6 Oxygen atoms in one glucose molecule.
Now lets look at another, larger compound.
Sulphuric acid
H2SO4
One molecule of sulphuric acid has 2 hydrogen atoms, one sulphur atom and 4 oxygen atoms.
If we spaced out the equation it would be
H2 S O4
Sometimes you might see brackets in these formula.
Aluminium sulfate
Al2(SO4)3
In this case the bracket tells us that there are 3 molecules of SO4.
Over all, Aluminium sulfate contains 2 Aluminium atoms, 3 sulphate and 12 oxygen.