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.
UK postcodes are made up of five to seven alphanumeric characters, created by Royal Mail. A full postcode identifies an area with many addresses or a single delivery point. Understanding the format helps you validate postcodes, build forms, and use tools like our area insights, crime data, and price paid data correctly.
Key patterns
Every UK postcode fits one of these patterns. The first part is the outward code (before the space), the second is the inward code (exactly three characters after the space).
| Format | Outward code | Inward code | Example |
|---|---|---|---|
| AA9A 9AA | AA9A | 9AA | SW1A 1AA |
| A9A 9AA | A9A | 9AA | W1A 0AX |
| A9 9AA | A9 | 9AA | M1 1AA |
| A99 9AA | A99 | 9AA | B1 1AB |
| AA9 9AA | AA9 | 9AA | CM2 9JR |
| AA99 9AA | AA99 | 9AA | CV10 0AB |
Outward code
The outward code is the part of the postcode before the space. It identifies the town or area. Some outward codes are non-geographic (e.g. for PO boxes).
- Always starts with a letter
- May end with a number or a letter
- Between 2 and 4 characters long
Examples: SE1P, RH10, W1A, L1.
Inward code
The inward code is the part after the space. It helps sort and deliver mail within the outward area.
- Always starts with a digit
- Exactly 3 characters long (one digit + two letters)
Examples: 8JQ, 7HF, 0NY.
Postcode area
The postcode area is the longest initial string of letters in the postcode. It usually corresponds to a town, city or region.
Examples: BT (Northern Ireland), EH (Edinburgh), L (Liverpool), SW (South West London).
District code
The district code is part of the outward code: the area letters plus the numbers, but not the trailing letter (if any). It is 2–4 characters.
Examples: SE1, RH10, W1, L1.
Sub-district code
The sub-district code appears only in some outward codes, mainly in dense London areas. It includes the trailing letter omitted from the district (3–4 characters).
Examples: SE1P, E1W, NW1W, EC1A, W1A.
Postcode sector
The postcode sector is the outward code plus a space plus the first character of the inward code (the digit). It is 4–6 characters including the space.
Examples: CV1 4, L1 8, SW1W 0.
Postcode unit
The postcode unit is the last two letters of the postcode. It usually represents a small set of addresses, a single property, or part of a street.
Examples: JQ (from L1 8JQ), HF (from GU16 7HF), NY (from SW1W 0NY).
How to use UK postcodes
Valid UK postcodes have 5, 6, or 7 characters (ignoring the space). You can normalise input by removing spaces and hyphens, then inserting a space before the last three characters (the inward code). Use this when building search forms or calling APIs—for example on our map search, nearest stations, and postcode report tools.
Enter any valid UK postcode (5–7 characters) to get area insights, crime data, house prices, EPC data, and more.
This guide is based on Royal Mail’s postcode system and common usage. For official validation and address lookup, use Royal Mail’s or other authorised services. Our data sources page explains where we get our postcode and property data.