A standard UK postcode has an outward code, a space and an inward code. The outward part has two to four characters; the inward part has three. For display, use capitals and put one space before the last three characters: EC1A 1HQ.
An “invalid postcode” message can mean several things. The input may be malformed, the address may be missing from a lookup, or the website may not serve it. Fixing the spacing only addresses the first possibility.
Where does the space go?
The Office for National Statistics describes the two-part structure:
| Part | Example | What to look for |
|---|---|---|
| Outward code | EC1A | The two to four characters before the space |
| Inward code | 1HQ | The last three characters, starting with a digit |
| Full postcode | EC1A 1HQ | Both parts, separated by one space |
The outward code is not always four characters: in M2 5BQ, it is just M2. Both examples appear in the UPU’s UK addressing guide. They illustrate structure, not addresses you can use for deliveries; we have not checked their current delivery records here.
Ordinary UK postcodes contain five to seven letters and digits, excluding the space, or six to eight characters with it. This is a useful copying check, not a complete validation rule. A plausible-looking combination is not proof that a postcode has been allocated.
Are capitals and a space compulsory in a form?
Use capitals and a single space for a clear, standard presentation. For domestic post, the Post Office addressing guide also places the town and full postcode on separate lines, in capitals.
Form input is a different matter. The GOV.UK address pattern advises service designers to accept upper- or lower-case letters and postcodes with or without a space. It also recommends a manual address option. That guidance does not establish how every retailer’s form behaves.
A form can therefore normalise ec1a1hq to EC1A 1HQ. That changes presentation, not the address’s validity. If a form rejects your input, follow its instructions and try standard spacing and capitals. Do not change the underlying letters or digits to make it accept a different postcode.
Work through the error you actually have
| What happens | What to check next |
|---|---|
| An immediate format error | Confirm that the selected country is United Kingdom. Compare every character with the recipient’s details, remove accidental pasted characters, and use the form’s requested presentation. |
| The postcode is accepted but the property is missing | Search the actual address or postcode in Royal Mail Postcode Finder. Checking the shape of the code is not enough. |
| Several similar addresses appear | Match the house number, building and flat details. Do not select the first result simply because the postcode agrees. |
| A new build or a converted property is absent | Royal Mail says these may not yet be in its database. Ask the recipient to check its missing or incorrect address process. Because it asks for personal and property details, the address holder or an authorised representative should handle the report. Do not submit someone else’s details without permission. There is no instant-update promise. |
| Royal Mail lists it, but another website rejects it | Keep the real address. Check that website’s delivery coverage and manual entry option, or ask its support team. Do not substitute a neighbour’s postcode. |
Royal Mail can also show alternative address names, such as historic building names. A different label alone does not establish a different property: compare the full details. We checked the published guidance for this article, not an individual delivery address or a merchant’s checkout.
Does a postcode identify one home?
Not necessarily. A postcode can cover multiple addresses, and Royal Mail cautions against treating postcodes as precise geographic locations. You still need the appropriate property and unit details.
Keep these checks separate: format, current address record, full address match, and the service’s acceptance conditions. Passing one does not prove the others or guarantee delivery.
A short checklist for forms and CSV files
Store a postcode as text. Accept reasonable differences in case and spacing, then normalise its presentation while keeping the original available until the user confirms the result. Do not silently guess a mistyped character or treat a lookup timeout as evidence that an address does not exist.
Let the user confirm the full lookup result and provide a manual path when a record is missing. A regular expression can catch some input mistakes; it cannot establish a current, deliverable address.
For imports, check what actually survives in the file. Our Excel and CSV postcode guide explains text-field handling; its US ZIP-code padding examples must not be applied to UK alphanumeric postcodes.
The UK address generator can provide examples for learning and development tests. Generated data is not a Royal Mail lookup result or evidence of delivery, billing or identity-verification eligibility. For a real order, use the recipient’s confirmed, complete address.