UK Postcode Lookup
A UK postcode lookup resolves a real postcode district to the post town, county and country it belongs to, and breaks the postcode into its area, district, sector and unit. It answers "which county is this postcode in"; it does not return the address of an individual property.
The lookup accepts a full postcode (SW1A 1AA), an outward code (M20), a postcode area (BT) or a post-town name (Cardiff), and returns the matching geography from the curated registry along with a structural breakdown of the postcode. The districts and post towns are real, so the county and country it reports are correct. What it cannot do is find a property: it will not tell you who lives at a postcode, list the addresses on a street, or confirm that a particular house exists — that needs a licensed Postcode Address File provider. When a district is not in the registry it says so rather than inventing a result.
Options
| Name | Type | Default | Description |
|---|---|---|---|
q | string | — | Postcode, outward code, postcode area or post town. |
Use cases
- Understanding a postcode: See exactly which characters form the area, district, sector and unit, and which format the postcode matches.
- Checking district coverage: List every postcode district served by a post town before writing delivery-zone rules.
- Debugging address matching: Confirm whether a district genuinely belongs to the post town an address claims.
REST API
GET /api/v1/postcodes/lookup
curl "https://ukaddressgenerator.org/api/v1/postcodes/lookup?q=M20"
{
"status": "success",
"data": {
"query": "M20",
"found": true,
"outwardCode": "M20",
"area": "M",
"district": "M20",
"postTown": "MANCHESTER",
"locality": "Didsbury",
"county": "Greater Manchester",
"country": "England",
"region": "North West England",
"diallingCode": "0161",
"latitude": 53.4808,
"longitude": -2.2426
}
}
Frequently asked questions
- Is this a Royal Mail PAF lookup?
No. It reports postcode structure and the relationship between a district and its post town using a curated registry. It cannot confirm that an individual property exists — that requires a licensed Postcode Address File provider.
- What can I search for?
A full postcode, an outward code such as M20, a postcode area such as BT, or a post-town name such as Cardiff.
- Why does a valid postcode sometimes return no match?
The registry covers a curated set of post towns. A structurally valid postcode in a district outside that set is reported as valid but unmatched, rather than being guessed at.
Reading a UK postcode: area, district, sector, unit
What each level of the hierarchy means and what it is useful for · 250 words
1. The hierarchy
Take M20 8DP. The area is M — Manchester and its surroundings. The district is M20 — Didsbury, around 3,000 delivery points. The sector is M20 8 — a few hundred addresses. The unit is M20 8DP — typically about fifteen addresses, often one side of a street.
That is why a postcode plus a house number identifies a UK property almost uniquely, and why British address forms lead with a postcode lookup instead of asking for the full address.
2. What each level is used for
Areas suit coarse regional grouping. Districts are the level most businesses use for delivery zones, pricing and coverage maps. Sectors appear in route planning and demographic reporting. Units are the level a full postcode identifies and the level at which addresses are matched.
Note that postcode districts do not align with local authorities, and some cross county boundaries — the S area spans Sheffield, Rotherham, Barnsley and parts of Derbyshire.
3. What this tool can and cannot tell you
It resolves structure and district-to-post-town relationships from a curated registry. It does not query Royal Mail's Postcode Address File, so it cannot confirm that a specific property exists or receives post. When there is no match it says so, rather than returning a plausible guess.
curl "/api/v1/postcodes/lookup?q=M20"
curl "/api/v1/postcodes/lookup?q=BT"
curl "/api/v1/postcodes/lookup?q=Cardiff"
More questions
- Why do some postcodes cover a huge area and others a single building?
Density. A rural unit postcode may cover several scattered properties, while a large office block or government department can hold a postcode of its own as a large user.
- Do postcode districts follow council boundaries?
No. They follow mail-sorting logistics and frequently cross local-authority and county boundaries.