I have been searching for the last few days and have found a number of datasets but nothing that meets my needs.

Effectively I need a table to postcodes that contain a flag on if it exists within a City (actually quite easy to do manually), Town or Village.

I think this might be a tall order as I don't even think any of the paid sources has the flags that I need, so this is a last resort really.

A flat file would be ideal but an API will also be fine.


3 Answers 3


Check the following UK Postcodes datasets:

  • ONS: the National Statistics Postcode Lookup (NSPL)

    The NSPL does this by allocating UK postcodes to Output Areas (OA) using the same methodology as that for the ONSPD. These OAs are then referenced to a wide range of higher statistical geographies (for example, local authority districts) by a best-fit methodology that uses Census population data.

  • Ordnance Survey's OS Code-Point Open dataset (see Products page)
  • Open Postcode Geo

    British postcodes with easting, northing, latitude, and longitude. With additional fields for geospace applications, including postcode area, postcode district, postcode sector, incode, and outcode.

For more dataset suggestions, check out at the data.gov.uk site.


Try OS Open Names:


This gives you a "populated place" for each postcode, for example RG4 7LR is in the populated place "Caversham".

What you don't get is the strict City/Town/Village hierarchy in your question.


What you want is available in the UK Data Service website. The link has files containing every single postcode and the "Census built-up area" (BUA) to which it belongs. As the User Guides (February 2015) state:

England and Wales:

Built-up areas and built-up area sub-divisions were created as part of the 2011 Census outputs and provide information on villages, towns and cities, allowing comparisons between people living in built-up areas and those living elsewhere. Previously called urban areas, data has been produced every 10 years since 1981. A new methodology to capture the areas was used in the 2011 version, but it still follows the rules used in previous versions so that results will be broadly comparable.

Scotland and Northern Ireland:

This data is not yet available.

The data comes in a massive .csv file where the BUA column has codes like E35000003 and E35001670. The city, town or village to which these codes belong are available in an associated file, both as .txt and .csv.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.