Open Nav

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.

Updated 20 Jul 2020

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.

Key Patterns

UK postcodes can assume one of the following patterns:

Postcode Format Outward Code Inward Code Postcode Area District Code Sub-District Sector Unit
AA9A 9AA AA9A 9AA AA AA9 AA9A AA9A 9 AA
A9A 9AA A9A 9AA A A9 A9A A9A 9 AA
A9 9AA A9 9AA A A9 N/A A9 9 AA
A99 9AA A99 9AA A A99 N/A A99 9 AA
AA9 9AA AA9 9AA AA AA9 N/A AA9 9 AA
AA99 9AA AA99 9AA AA AA99 N/A AA99 9 AA

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

Inward Code

The inward code is the second half of a postcode (before 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

Postcode Area

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

Examples include:

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

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

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

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

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)

Code

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

Try it below:

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