The UK Postcode Format

The UK Postcode Format

A comprehensive outline of UK postcode patterns, its constituent components and how they can be utilised. Split a postcode into outward code, inward code, postcode area, district code, sub-district code, postcode sector and postcode unit.

The UK postcode consists of five to seven alphanumeric characters which was created by Royal Mail. A full postcode designates an area with multiple addresses or a single delivery point. If you're looking to accurately search for an address from a postcode, try our postcode lookup tool.

Key Patterns

UK postcodes can assume one of the following patterns:

Postcode FormatOutward CodeInward CodePostcode AreaDistrict CodeSub-DistrictSectorUnit
AA9A 9AAAA9A9AAAAAA9AA9AAA9A 9AA
A9A 9AAA9A9AAAA9A9AA9A 9AA
A9 9AAA99AAAA9N/AA9 9AA
A99 9AAA999AAAA99N/AA99 9AA
AA9 9AAAA99AAAAAA9N/AAA9 9AA
AA99 9AAAA999AAAAAA99N/AAA99 9AA

N/A means not applicable

Postcode Components

Postcodes can also be broken down into meaningful constituent components.

Postcode Components

Definitions

Outward Code

The outward code is the first half of a postcode (before the space). Some are non-geographic, i.e. does not divulge the location.

Distinguishing features include:

  • 2-4 characters long
  • Always begins with a letter
  • May end with a number or letter

Examples of outward codes include:

  • L1
  • W1A
  • RH1
  • RH10
  • SE1P

CSV Download full list of UK outward codes.

Inward Code

The inward code is the second half of a postcode (after the space). The inward code assists in the delivery of post within a postal district.

Its distinguishing features are:

  • Exactly 3 characters long
  • Always begins with a number

Examples of inward codes:

  • 0NY
  • 7GZ
  • 7HF
  • 8JQ

CSV Download full list of UK inward codes.

Postcode Area

The postcode area is the longest initial string of letters in a postcode.

Examples include:

  • L (Liverpool)
  • EH (Edinburgh)
  • BT (Northern Ireland)

Check our list of postcode areas for reference.

CSV Download full list of UK postcode areas.

District Code

The district code is part of the outward code. It is between two and four characters long. It does not include the trailing letter found in some outcodes.

Examples of district codes include:

  • L1
  • W1
  • RH1
  • RH10
  • SE1

CSV Download full list of UK postcode districts.

Sub-District Code

The sub-district code is part of the outward code. It is often not present, only existing in particularly high density London districts. It is between three and four characters long. It does include the trailing letter omitted from the district.

Examples of Sub-District codes:

  • W1A
  • EC1A
  • NW1W
  • E1W
  • SE1P

CSV Download full list of UK postcode sub-districts.

Sector

The postcode sector is made up of the postcode district, the single space and the first character of the inward code. It is between four and six characters long (including the single space).

Examples of postcode sectors:

  • SW1W 0
  • PO16 7
  • GU16 7
  • L1 8
  • CV1 4

CSV Download full list of UK postcode sectors.

Unit

The postcode unit is the last two letters of a postcode.

Each postcode unit generally represents:

  • a street
  • part of a street
  • a single address
  • a group of properties
  • a single property
  • a sub-section of the property
  • an individual organisation or (for instance Driver and Vehicle Licensing Agency)
  • a subsection of the organisation

The level of discrimination is often based on the amount of mail received by the premises or business.

Examples of postcode units:

  • NY (from SW1W 0NY)
  • GZ (from PO16 7GZ)
  • HF (from GU16 7HF)
  • JQ (from L1 8JQ)

CSV Download full list of UK postcode units.

Code

We publish an open-source library called Postcode. This package allows you to extract parts of a postcode outlined above.

Ideal Postcodes Address Validation is a great solution to ensure your data is accurate and up-to-date. We offer comprehensive data with every postcode, incorporating premise-level address information, unique property reference numbers (UPRNs), geolocations and more.

import { parse } from "postcode";

const {
  postcode, // => "SW1A 2AA"
  outcode, // => "SW1A"
  incode, // => "2AA"
  area, // => "SW"
  district, // => "SW1"
  subDistrict, // => "SW1A"
  sector, // => "SW1A 2"
  unit, // => "AA"
  valid, // => true
} = parse("Sw1A 2aa");

An invalid input returns valid: false with every other field null.

FREE TRIAL

Try Address Validation for Free

No Risk · No Credit Card Required · Free Support

  • 1-month free trial with 50 free credits
  • Includes UPRN & Geocodes at no additional charge
  • Global address data sourced from each country's database