An Earl comes below a Duke - Edward is currently the Earl of Sussex and is said to be waiting to be Duke of Edinburgh: the wife of an Earl is a Countess. A Viscount is the son of an Earl
Not quite…
The UK peerage has a pecking order of titles. Starting from the top, they are:
Duke
Marquess
Earl
Viscount
Baron
There are any number of peers in the UK who hold one of these titles - the Duke of Norfolk, the Marquis of Bath, Earl Spencer etc etc.
If you hold one of the higher ranks in the peerage, often you will also have been awarded titles from the lesser ranks at the same time. So, to take the Duke of Devonshire as an example, whoever holds the title of Duke also holds the titles of the Marquess of Hartington, the Earl of Burlington, and Baron Cavendish. They will only use one title at a time, however, and usually that will be the highest ranked title - i.e. Duke.
It has become custom for peers to accordingly allow their heirs use their subsidiary title to indicate their position as heir to the eventual higher title. This is known as a courtesy title. So, to stay with the Duke of Devonshire for the moment, his oldest son will style himself the Marquess of Hartington, and his oldest son in turn will style himself the Earl of Burlington.
So, when Tony Armstrong-Jones married Margaret, he was given the title Earl Snowden, with the subsidiary title Viscount Linley. Hence their son used that title for years until his father died, and it’s now used by his own son in turn.
(Most of this knowledge comes from tears of reading Georgette Heyer books, by the way 😀)