Every address in England, Scotland, Wales, Northern Ireland and the Crown Dependencies carries a postcode that follows a strict format defined in Royal Mail BS 7666. Whether you are cleaning an address database, building a form with postcode validation, or just double-checking something from a handwritten envelope, this tool tells you instantly whether the format is correct and breaks the postcode down into its constituent parts — all in your browser, with nothing uploaded.
How UK postcodes are structured
A UK postcode always has two parts separated by a space: the outward code and the inward code.
The outward code has two sub-parts.
- The Area is one or two letters at the very start (e.g. SW, EC, M, B). It identifies the broad postal area — M for Manchester, SW for South West London, AB for Aberdeen. There are around 120 postal areas in active use.
- The District follows the area letters. It is one or two digits, sometimes with a trailing letter for a sub-district (e.g. 1A in SW1A or the plain 1 in SW1). The district tells Royal Mail which delivery office to route to within the area.
The inward code is always exactly three characters.
- The Sector is a single digit (0–9) that subdivides the district for sorting.
- The Unit is two letters that identify a specific street, part of a street, or even a single large building. Six letters are reserved and never appear in the unit position: C, I, K, M, O and V — they are excluded because they can be confused with digits in handwriting and OCR.
This gives six valid structural patterns:
| Pattern | Example |
|---|---|
| A9 9AA | M1 1AA |
| A99 9AA | B15 1AB |
| AA9 9AA | SW1 1AA |
| AA99 9AA | SW1W 0NY |
| A9A 9AA | EC1A 1BB |
| AA9A 9AA | W1A 0AX |
How the validator works
Step 1 — Normalisation. Spaces are stripped and the input is uppercased so that sw1a 2aa, SW1A2AA and SW1A 2AA all resolve identically.
Step 2 — Special postcode check. Two postcodes lie outside the standard pattern: GIR 0AA (the historic Girobank postcode) and BFPO codes (e.g. BFPO 801). These are checked first and returned as valid with a service label.
Step 3 — Regex match. The normalised string is tested against the full Royal Mail BS 7666 regex that encodes every valid combination of area letters, district digits, sector and unit.
Step 4 — Reserved-letter check. Even a structurally matching postcode fails if either inward-unit letter is from the reserved set (C, I, K, M, O, V).
Step 5 — Area lookup. The extracted Area code is looked up against the Royal Mail postal area table. Recognised areas get a town or region label; unrecognised areas are flagged (without failing the format check, since the format spec itself does not enumerate every area in its grammar).
Worked examples
SW1A 2AA — the postcode for 10 Downing Street.
- Area: SW (South West London)
- District: 1A (sub-district of SW1)
- Sector: 2
- Unit: AA (no reserved letters)
- Result: Valid
EC1A 1BB — a City of London code using the A9A 9AA pattern.
- Area: EC (East Central London)
- District: 1A
- Sector: 1
- Unit: BB
- Result: Valid
AA1 1CI — a plausible-looking code with a reserved unit letter.
- Area: AA (not a real area — flagged as unknown)
- Unit: CI contains I, which is reserved
- Result: Invalid — reserved letter in unit
| Postcode | Result | Reason |
|---|---|---|
| SW1A 2AA | Valid | Standard AA9A 9AA pattern, known area |
| M1 1AA | Valid | A9 9AA pattern, Manchester |
| GIR 0AA | Valid | Historic Girobank special case |
| BFPO 801 | Valid | British Forces Post Office |
| EC1A 1BB | Valid | A9A 9AA sub-district pattern |
| ZE1 0AA | Valid | Shetland area |
| 123 4AB | Invalid | Starts with digits, not letters |
| SW1A 2OA | Invalid | O is a reserved unit letter |
Every check runs in your browser. No postcode you enter is ever sent anywhere.