Postcodes
Spaces and Hyphens in Postcodes
Should a postcode include a space or hyphen? Learn why separators exist, when they are required and how to handle them in forms and data.
Updated 14 October 2026 · 3 min read
Separators in postcodes, such as a space or a hyphen, help people read and remember the code. Whether they are required depends on the country and on the system reading them.
Why separators exist
A long code is easier to read in groups. In two-part systems, the separator marks the boundary between a broad area part and a local part, as explained in outward and inward codes explained. In extended numeric systems, a hyphen sets the extra digits apart from the base code, as in ZIP+4 and extended postal codes.
Are they necessary?
For mail, the separator is mostly a convenience. Sorting equipment and staff recognise the code with or without it. Many countries' formats are written with a space or hyphen, though, and strict online forms may expect exactly that.
What to do when typing
- Follow the format shown on official mail addressed to that place.
- If a form shows an example, copy its style.
- If a form rejects your entry, try adding or removing the separator.
What to do when building forms
Be tolerant. A kind approach is to:
- strip spaces and hyphens from what the user types
- convert to a single case
- validate the remaining characters against the country format
- display or store the code in the standard format
This avoids rejecting valid codes because of punctuation. See postcode validation: key concepts and postcode formats in online forms.
Storing for matching
If you compare postcodes in a database, matching "AB1 2CD" with "AB12CD" fails unless both are normalised. Pick one stored form, such as no separator and upper case, and apply it everywhere, including to the data you import.
Not to be confused with exact-location codes
Separator conventions apply to postal codes. An exact-location code from UPCS uses hyphens by design: a country prefix and two blocks, for example PK-1A2B-3C4D. These are part of that code format and are not official postcodes.
Key takeaway
The simplest policy for developers is to accept anything a person might reasonably type, store one canonical form, and display the standard form back to the user. That way nobody is rejected for punctuation and your data still matches cleanly.
Frequently asked questions
Do I have to include the space in a postcode?
Usually it is best to follow the country's standard format, but many forms and postal systems still recognise the code without it.
Should I store a postcode with or without the separator?
Either works if you are consistent. Many systems store a normalised version and display it in the standard format.
