United Kingdom
UK Postcode Format Guide
UK postcodes are alphanumeric and usually contain an outward code, a space, and an inward code. They are more varied than many numeric postal-code systems, which makes them important for address-form testing.
Common UK postcode examples
SW1A 1AA
EC1A 1BB
M1 1AE
B15 2TT
EH3 7TH
Outward and inward code
The outward code appears before the space and identifies a postcode area and district. The inward code appears after the space and usually contains one digit followed by two letters. Forms should preserve the space and support both short and long outward codes.
UK address fields to test
- Flat, apartment, studio, or unit line.
- Building name, which may appear before the street line.
- Street and locality.
- Post town, often displayed in uppercase.
- County or region, which may be optional depending on the system.
- Postcode with a required internal space.
Generate UK postcode samples
Use the UK address generator to create random UK-style test addresses with postcodes, post towns, optional regions, local-looking names, and phone numbers.
Normalization test vectors
| User input | Display value | What the test proves |
|---|---|---|
sw1a 1aa | SW1A 1AA | Case normalization without character loss |
SW1A 1AA | SW1A 1AA | Repeated internal whitespace is collapsed |
M1 1AE | M1 1AE | A short outward code is accepted |
EC1A1BB | Product-defined | The UI either inserts the space or gives a precise correction |
Validation boundaries
A regular expression can check a plausible shape, but it cannot prove that a postcode is active or belongs to the submitted premise. Store the postcode as text, preserve the canonical space, and keep format validation separate from address lookup or deliverability services.
Primary reference
Royal Mail's Postcode Finder is the appropriate route for checking a real UK delivery address. Generated examples on this site are intended only for software testing.