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

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 inputDisplay valueWhat the test proves
sw1a 1aaSW1A 1AACase normalization without character loss
SW1A   1AASW1A 1AARepeated internal whitespace is collapsed
M1 1AEM1 1AEA short outward code is accepted
EC1A1BBProduct-definedThe 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.