Image copyright Thinkstock

The most desirable postcodes in England, Scotland and Wales have been revealed by Royal Mail.

The firm evaluated the employment opportunities, quality of health and education, crime rates and housing affordability of areas across Britain.

The garrison town of Tidworth, in Wiltshire - postcode SP9 - was crowned the best place to live in England.

G44, on Glasgow's south side, topped the Scottish table, while LL78, Brynteg on the Isle of Anglesey, won for Wales.

The study, carried out to mark the 40th anniversary of the postcode, was conducted in conjunction with the Centre for Economic and Business Research (CEBR).

It took the following factors into account, using data from government agencies, the Office for National Statistics and the Land Registry

Employment opportunities

Health

Education and training opportunities

Levels of crime

Homelessness

Household overcrowding

Ease of access to local services

Quality of the physical environment

Housing affordability

Image copyright Getty Images Image caption Tidworth is famous for its polo clubs

In England, Tidworth, on the edge of Salisbury Plain in Wiltshire, came first. The town is widely known for its military barracks, as well as for its polo club, which is frequented by the royal family.

Five most desirable postcodes in England 1. Tidworth, Wiltshire (SP9) 2. Yateley, Hampshire (GU46) 3. St Bees, Cumbria (CA27) 4. Middlewich, Cheshire (CW10) 5. Earley, Berkshire (RG6)

Image copyright Getty Images Image caption Despite being near a nuclear power station, Largs in Scotland is a popular resort

The south side of Glasgow was named the most desirable place to live in Scotland. An affluent residential neighbourhood, G44 is home to golf courses and parks.

Five most desirable postcodes in Scotland 1. South Glasgow (G44) 2. Erskine, Renfrewshire (PA8) 3. Largs, Ayrshire (KA30) 4. Menstrie, Clackmannanshire (FK11) 5. Port Askaig, Isle of Islay (PA46)

Image copyright Getty Images Image caption The Duke and Duchess of Cambridge spent their first years of marriage on Anglesey

Brynteg, on the Isle of Anglesey off the coast of north-west Wales, topped the charts in that country. The village, home to fewer than 2,000 people, offers spectacular views of the surrounding countryside, and is a popular holiday destination.

Five most desirable postcodes in Wales 1. Brynteg, Isle of Anglesey (LL78) 2. Llantwit Major, Vale of Glamorgan (CF61) 3. Llanidloes, Powys (SY18) 4. Caldicot, Monmouthshire (NP26) 5. North West Swansea, West Glamorgan (SA4)

There are around 1.8 million postcodes across the UK, covering a total of over 29 million addresses.

The combination of letters and numbers was chosen because it was considered easier to remember that a string of either numbers or letters on their own.