How to Find Census Data by Postcode
Postcodes are how most people think about location in the UK — but the census doesn't publish data at postcode level. This guide explains how to bridge the gap between postcodes and census geographies, so you can pull accurate demographic data for any postcode in England and Wales.
Why the Census Doesn't Use Postcodes
The Office for National Statistics (ONS) publishes census data using its own geographic hierarchy: Output Areas (OAs), Lower Super Output Areas (LSOAs), Middle Super Output Areas (MSOAs), wards, local authority districts, regions, and nations. These are designed to be stable over time and to contain roughly equal population sizes — properties that postcodes lack.
Postcodes are managed by Royal Mail for mail delivery, not for statistical analysis. They vary wildly in size: a single postcode might cover one block of flats (20 households) or an entire rural hamlet spread across several miles. Postcodes are also created, split, and retired frequently — Royal Mail processes thousands of postcode changes each year. Building a statistical framework on something that shifts constantly would undermine the consistency that census data requires.
That said, postcodes are the geographic reference most people actually use. When a business wants to know "who lives near my proposed store location" or a researcher needs "the demographics of this neighbourhood," they start with a postcode. The solution is a lookup — mapping each postcode to the census geography that contains it.
The Postcode-to-Census Lookup
ONS publishes the National Statistics Postcode Lookup (NSPL), updated quarterly. This file maps every live and terminated UK postcode to its corresponding Output Area, LSOA, MSOA, ward, local authority, clinical commissioning group, and parliamentary constituency.
The NSPL is the canonical bridge between postcodes and census geographies. The February 2024 release contains approximately 2.7 million postcode records. Each row gives you:
| Field | Description | Example |
|---|---|---|
| pcds | Postcode (7-character format) | SW1A 1AA |
| oa21 | 2021 Census Output Area code | E00023938 |
| lsoa21 | 2021 LSOA code | E01004736 |
| msoa21 | 2021 MSOA code | E02000979 |
| laua | Local Authority code | E09000033 |
| rgn | Region code | E12000007 |
| lat / long | Grid reference centroid | 51.501, -0.141 |
Where to Download the NSPL
The NSPL is available free from the ONS Open Geography Portal. Navigate to "Postcode Lookups" and download the latest release. The file is a zipped CSV, approximately 350 MB uncompressed. It is released under the Open Government Licence v3.0.
Using the NSPL in Practice
Suppose you have a postcode — say, B5 4UA (central Birmingham). You look it up in the NSPL and find it maps to LSOA E01009376 (Birmingham 138). You can then pull any census variable for that LSOA from the ONS census tables: population count, age distribution, ethnic group breakdown, housing tenure, deprivation rank, and dozens more.
If you have a list of customer postcodes, the workflow is:
- Load the NSPL into a database or data tool (Python/pandas, R, SQL)
- Join your postcode list against the NSPL to get LSOA codes
- Join the LSOA codes against census data tables
- Aggregate or analyse as needed
This three-step join is the standard method used by market researchers, local government analysts, health service planners, and academic researchers across the UK.
Postcode precision: A single postcode typically maps to one Output Area, but postcodes that straddle OA boundaries may be assigned to the OA containing the postcode's population-weighted centroid. For most practical purposes this is accurate enough, but for boundary-sensitive analysis (e.g., school catchment areas), consider using full address-level lookups.
Alternative Methods for Postcode Lookups
ONS Postcode Directory (ONSPD)
The ONSPD is similar to the NSPL but includes additional health and administrative geographies. It also retains terminated postcodes with a termination date, which is useful for historical analysis. Choose the ONSPD if you need health authority or PCT mappings; use the NSPL for standard census geography work.
ONS Custom Data API
ONS has been developing API access to census data. The Census 2021 API (currently in beta) allows programmatic queries by geography code. Once you have the LSOA code from a postcode lookup, you can query the API directly rather than downloading bulk tables.
CensusWise
CensusWise lets you explore census data at local authority and regional level without any file downloads or coding. If you need a quick demographic profile for a specific area, the Data Explorer provides instant access to population, ethnicity, deprivation, and economic data.
Skip the postcode lookup. CensusWise pre-processes census data so you can explore demographics for any local authority instantly.
Open Data ExplorerStep-by-Step: Postcode Demographics in Python
For analysts who want to build their own postcode-to-demographics pipeline, here is the practical workflow:
Step 1: Download the Data
You need two files:
- NSPL from the ONS Open Geography Portal
- Census 2021 bulk data for your topic of interest (e.g., population by age, TS009 — ethnic group)
Step 2: Load and Join
Using Python and pandas:
- Load the NSPL CSV, keeping only the columns you need (
pcds,lsoa21,laua) - Load the census table CSV — these use geography codes as row identifiers
- Merge on the LSOA code column
Step 3: Query by Postcode
With the joined dataset, you can filter to any postcode and retrieve the census variables for its LSOA. If you need to aggregate across multiple postcodes (e.g., "all postcodes within 2 miles of my store"), use the lat/long coordinates from the NSPL to calculate distances and then aggregate the LSOA-level data.
Step 4: Handle Edge Cases
- Terminated postcodes: These have a
doterm(date of termination) field in the NSPL. Decide whether to include or exclude them. - Scottish postcodes: The 2021 Census covers England and Wales only. Scottish postcodes map to different census outputs from National Records of Scotland (Scotland's Census 2022).
- Northern Irish postcodes: BT-prefix postcodes map to NISRA's census outputs.
Common Use Cases
Retail Site Selection
Retailers use postcode-level demographics to evaluate potential store locations. The typical approach: identify the target postcode, pull the LSOA demographics (age profile, income proxy via deprivation, household composition), and compare against the retailer's customer profile. A childrenswear brand would look for LSOAs with high proportions of families with dependent children; a premium food retailer would target areas with low deprivation ranks.
Catchment Area Analysis
Schools, hospitals, GP surgeries, and leisure centres define catchment areas using postcodes. By mapping those postcodes to census geographies, they can profile their catchment population — essential for service planning, demand forecasting, and equality impact assessments.
Direct Mail and Customer Profiling
Marketing teams often hold customer databases with postcodes but no demographic data. Joining against census data via the NSPL lets them build demographic profiles of their customer base without purchasing commercial geodemographic products. While not as granular as Experian Mosaic or CACI Acorn, census-based profiling is free and based on the most comprehensive population data available.
Housing Market Analysis
Property developers and housing associations use postcode-to-LSOA lookups to understand the demographic composition of areas they are considering for development. Census data on housing tenure (owner-occupied vs. rented vs. social housing), overcrowding indicators, and household size feeds directly into housing needs assessments.
Understanding Postcode Geography
UK postcodes follow a hierarchical structure that is worth understanding when you are working with them:
| Level | Example | Typical Coverage |
|---|---|---|
| Postcode Area | SW | Major city zone or county |
| Postcode District | SW1A | Part of a town or district |
| Postcode Sector | SW1A 1 | Neighbourhood (avg. ~3,000 addresses) |
| Postcode Unit | SW1A 1AA | Street or part of street (~15 addresses) |
Census data is never published at postcode unit level — the population is too small and disclosure risks are too high. The smallest census geography, the Output Area, typically covers 40–250 households, which roughly corresponds to a postcode sector or a cluster of postcode units.
If your analysis requires postcode district-level aggregation (e.g., "demographics of the SW1A area"), you will need to aggregate LSOA data across all postcodes within that district. The NSPL makes this straightforward — filter all rows where the postcode starts with your target prefix, collect the unique LSOAs, and sum or average the census variables.
Population-weighted averages: When aggregating LSOA data across multiple postcodes, always use population-weighted averages rather than simple means. An LSOA with 2,500 residents should carry more weight than one with 800 residents. The census provides population counts for every LSOA, so this is straightforward to implement.
Data Quality and Limitations
Timing
The 2021 Census data reflects the population on 21 March 2021 — during the third COVID-19 lockdown. Some areas (particularly city centres with large student populations) may show unusual patterns because people were living elsewhere during lockdown. ONS has published quality notes on this for affected areas.
Postcode Precision
Approximately 1.5% of postcodes in the NSPL are flagged as "split" — meaning the postcode straddles two or more Output Areas. In these cases, the postcode is assigned to the OA containing the majority of its addresses. For most applications, this is a non-issue, but if you are doing fine-grained spatial analysis, consider using full address-level data from AddressBase (Ordnance Survey).
Commercial vs. Residential Postcodes
Some postcodes are purely commercial (offices, industrial estates) with no residential population. These will still map to an LSOA in the NSPL, but the census data for that LSOA reflects the people who live there, not the people who work there. If you are analysing footfall or workplace demographics, you need the census workplace tables (which are published separately) rather than the usual resident population tables.
Frequently Asked Questions
Can I get census data for a single postcode?
Not directly — the census does not publish at postcode level. However, you can map any postcode to its Lower Super Output Area (LSOA) using the ONS National Statistics Postcode Lookup, and then retrieve census data for that LSOA. An LSOA covers approximately 1,500 people, giving you a close neighbourhood-level view.
How accurate is postcode-to-LSOA mapping?
Very accurate for the vast majority of postcodes. About 98.5% of postcodes sit entirely within one Output Area and therefore map cleanly to one LSOA. The remaining 1.5% straddle boundaries and are assigned to the OA with the most addresses.
Is the postcode lookup data free?
Yes. The NSPL is published by ONS under the Open Government Licence v3.0 and is free to download and use for any purpose, including commercial use.
How often is the NSPL updated?
Quarterly — in February, May, August, and November. Each release incorporates new postcodes created by Royal Mail and updates any geography assignments that have changed due to boundary revisions.
Does this work for Scottish and Northern Irish postcodes?
The NSPL covers all UK postcodes. However, the 2021 Census data covers England and Wales only. For Scottish postcodes, you need Scotland's Census 2022 data from National Records of Scotland. For Northern Irish postcodes (BT prefix), use NISRA census outputs.
Related Guides