UK Postcode Lookup
A UK postcode lookup resolves a postcode or outward code to the post town, county and country it belongs to, and breaks the postcode into its area, district, sector and unit.
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. When there is no match it says so rather than inventing a result, which matters for a reference tool.
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.