If you're from the UK, your postcode should just be your postcode. As I understand it, there is no UK postcode that starts with 2. Just put in your entire postcode as you would normally put, and the "Please enter ..." message should either go away, or not matter. I believe the space should either go before the last 3 symbols in the postcode, or just before the last number. Answer from gogstars on reddit.com
🌐
Geoapify
geoapify.com › postcode-formats-around-the-world
What are the correct postcode formats around the world?
April 16, 2026 - The most common postcode format is numerical. However, some places use an alphanumeric postal code system, including Argentina, Canada, the UK, Brunei, Malta and the Netherlands. Alphanumeric systems make it possible to code many more addresses in one place, because you can build more variations using letters and numbers together, than from numbers alone.
Discussions

"Incorrectly formatted postal code" when entering "ZIP" for purchasing Microsoft 365
Dear Microsoft-Support Team, this is the second attempt for support. My zip code is 11427. I tried SE-11427, 11427, and as per Microsoft Support suggestion 11427-0001. None of these work. Could you please tell me what the correct format is? Thank you in… More on answers.microsoft.com
🌐 answers.microsoft.com
6
47
December 11, 2023
When entering my postcode it says incorrect format when trying to register my new bank card what can - Google Wallet Community
Skip to main content · Google Wallet Help · Sign in · Google Help · Help Center · Community · Google Wallet · Terms of Service · Submit feedback · Send feedback on More on support.google.com
🌐 support.google.com
US Zip Code - Validate 2 formats - English - thirty bees forum
The zip/postal code in the US has the basic 5 digit code ( e.g. 12345) and an optional suffix with a hyphen followed by 4 digits (e.g. 12345-1234). Is there a method to validate both formats when an address is entered? Setting either format in the Country works, but only a single format is valida... More on forum.thirtybees.com
🌐 forum.thirtybees.com
April 18, 2020
what is the correct postal code format for adding your micrsoft account ?
Hello, I'm trying to buy my office 360 but when I try to add my adress the post code is keep showing wrong format. what is the proper format of the post code? More on learn.microsoft.com
🌐 learn.microsoft.com
2
71
October 27, 2023
People also ask

What is the standard postcode format?
The standard postcode format is different from country to country. We recommend checking the postcode format for the country you want to get postcodes for, to make sure your results are accurate.
🌐
geoapify.com
geoapify.com › postcode-formats-around-the-world
What are the correct postcode formats around the world?
What is the UK postcode format?
UK postcodes have both letters and numbers. They are between five and seven characters long and always start with a letter. They follow the pattern: [A-Z]{1,2}[0-9][A-Z0-9]? [0-9][A-Z]{2}.
🌐
geoapify.com
geoapify.com › postcode-formats-around-the-world
What are the correct postcode formats around the world?
What is the German postcode format?
German postcodes have five numbers. The first two numbers show the geographic area, and the last three show the specific area within it.
🌐
geoapify.com
geoapify.com › postcode-formats-around-the-world
What are the correct postcode formats around the world?
🌐
ReStore
restore.ac.uk › geo-refer › 38330mtuks00y19740000.php
Correctly formatting postcodes - ReStore
Some hints and tips on the correct format of UK postcodes and some common errors
🌐
GeoPostcodes
geopostcodes.com › home › zip code formats: a global guide to accurate postal codes
Zip Code Formats: A global guide to accurate postal codes
1 week ago - This process typically involves parsing postal codes to extract geographic information and validating them against country-specific rules. One common approach is to use regular expressions (regex) to define patterns that match valid postal codes. ...
🌐
Quora
quora.com › How-can-I-fill-a-postal-code
How to fill a postal code - Quora
Answer (1 of 2): Either by writing or typing the pin code.
🌐
Wikipedia
en.wikipedia.org › wiki › List_of_postal_codes
List of postal codes - Wikipedia
February 12, 2026 - This list shows an overview of postal code notation schemes for all countries that have postal or ZIP Code systems. The Area format is used for large regions, such as municipalities. The Street level format is used for more specific locations, like streets or blocks.
Find elsewhere
🌐
Bullseye Locations
kb.bullseyelocations.com › bullseye locations knowledge base › codes and lookup values › postal code formats
Postal Code Formats - Bullseye locations Knowledge Base
Bullseye supports radius search ability for the countries listed in the table below. For these countries, you will need to conform to the postal code format that is displayed in the Format column when you upload your locations or manually type them into the form in the admin.
🌐
Market Research Society
mrs.org.uk › pdf › postcodeformat.pdf pdf
POSTCODE FORMAT A Postcode is made up of the following elements: PO1 3AX
- The second half of the postcode ... alpha format and the letters C, I, K, M, O and · V are never used. Postcodes should always be in BLOCK CAPITALS as the last line of an address. Do not underline the postcode or use · any punctuation. Leave a clear space of one character between the two ...
🌐
WinPure
winpure.com › blog › address standardization › postal codes: an ultimate guide
Postal Codes: An Ultimate Guide - WinPure
October 16, 2025 - Missing or Incomplete Postal Codes: It’s not uncommon for customers to miss out a number or a letter when entering postal code data. If you don’t have effective form validation practices (such as making 6 figure entry mandatory), you will have incomplete data. Some customers may also just provide address data but not accurate postal code data. You can avoid this issue by implementing automated validation that checks for a valid postal code in real-time as data is entered or uploaded. Incorrect Formatting: Most people fail to follow the proper lowercase requirements when entering a postal code.
🌐
SAS Support Communities
communities.sas.com › t5 › SAS-Programming › Identifying-correct-length-and-format-of-postal-codes › td-p › 791272
Identifying correct length and format of postal codes - SAS Support Communities
January 21, 2022 - the postal code should be six digits as in the example above, have no spaces, no special characters and the 2nd, 4th and the 6th spaces should be numbers and the first, third and fifth places alphabets.
🌐
Quora
quora.com › How-do-I-write-up-the-postal-using-the-zip-code
How to write up the postal using the zip code - Quora
Answer: In the United States, you enter the address online (such as at USPS) and that will tell you the Zip Code. You then place the ZIP code after the state abbreviation on the address. So the template is: [Mr./Ms./Mrs./Dr.] [FIRST NAME] [LAST NAME] [Street Number] [Street Name] [Unit/Apartme...
🌐
Amazon S3
s3.amazonaws.com › helpscout.net › docs › assets › 5cdefb182c7d3a6d82bda079 › attachments › 5e998cb02c7d3a7e9aeb20b5 › postcode_formats.pdf pdf
Note : represents number represents alphabet Sample: Toronto, Canada M 5 H 3 E
Postcode Format · Country Code and Postcode Formats · HUNGARY · HU · 4 · CANARY ISLANDS, THE · IC · 5 · INDONESIA · ID · 5 · ISRAEL · IL · 7 · INDIA · IN · 6 · ICELAND · IS · 3 · ITALY · IT · 5 · JERSEY · JE · 3 · JAPAN · JP · − · 8 ·
🌐
Intuitiveshipping
help.intuitiveshipping.com › article › how-to-format-postal-codes-for-intuitive-shipping
How To Format Postal Codes For Intuitive Shipping – Intuitive Shipping Help Center
June 3, 2021 - Leaving spaces between range colons – e.g. ‘11000 : 11123’. There should be no spaces between either postal code in the range and the colon. Leaving space between the first and second parts of UK Postal Codes – e.g. AB10 1AA. The correct format is AB101AA.
🌐
thirty bees forum
forum.thirtybees.com › general discussion › english
US Zip Code - Validate 2 formats - English - thirty bees forum
April 18, 2020 - The zip/postal code in the US has the basic 5 digit code ( e.g. 12345) and an optional suffix with a hyphen followed by 4 digits (e.g. 12345-1234). Is there a method to validate both formats when an address is entered?
Top answer
1 of 6
16

There are 6 possible formats for postcodes in the UK:

  • A9 9AA
  • A9A 9AA
  • A99 9AA
  • AA9 9AA
  • AA9A 9AA
  • AA99 9AA

I think there need to be two parts to your solution. The first is to validate the input; the second is to grab that first part.

Validation

This is really important, even though I realise you have said this is not what you are trying to do, but without it you are going to struggle to get the right prefix and possibly send your drivers to the wrong place!

There are a couple of ways you can do it, either use a 3rd party to help you capture a complete & correct address (many available including http://www.qas.co.uk/knowledge-centre/product-information/address-postcode-finder.htm (my company)), or at a minimum use some reg-ex / similar sanity testing to validate the postcodes - such as the links Dmitri gave you above.

If you look at the test cases you have listed - W1ABC and W10ABC are not valid postcodes - if we get that bit correct then the next bit becomes a lot easier.

Extract the Prefix

Assuming you now have a full, valid postcode getting just the first part (outcode) becomes a lot easier - with or without spaces. Because the second half (incode) has a standard format of 9AA, digit-alpha-alpha, I would do it by spotting and removing this, leaving you with just your outcode whether it be W1 From W1 0AA, or W10 from W10 0AA.

Alternatively, if you are using a 3rd party to capture the address - most of them will be able to return the incode and outcode separately for you.

2 of 6
2

In php I do

$first=trim(substr(trim($postcode),0,-3));

To get the first section of the postcode. I've been using it for years and just works. It doesn't matter whether the user includes the space (or 2 spaces) in middle, because the last section is always 3 characters. I work for a distribution company, and we get charged more for certain postcode areas. You will have a problem is somebody enters their postcode incorrectly, if they miss a character from the end.

If the above isn't good enough.

You can validate whether the postcode the user gave you is valid, then http://postcodes.io/ can help.

http://api.postcodes.io/postcodes/W11%202AQ will give you back some JSON with whether the postcode is valid.

{
    "status": 200,
    "result": {
        "postcode": "W11 2AQ",
        "quality": 1,
        "eastings": 524990,
        "northings": 181250,
        "country": "England",
        "nhs_ha": "London",
        "longitude": -0.200056238526337,
        "latitude": 51.5163540527233,
        "parliamentary_constituency": "Kensington",
        "european_electoral_region": "London",
        "primary_care_trust": "Kensington and Chelsea",
        "region": "London",
        "lsoa": "Kensington and Chelsea 004A",
        "msoa": "Kensington and Chelsea 004",
        "nuts": "Colville",
        "incode": "2AQ",
        "outcode": "W11",
        "admin_district": "Kensington and Chelsea",
        "parish": "Kensington and Chelsea, unparished area",
        "admin_county": null,
        "admin_ward": "Colville",
        "ccg": "NHS West London (Kensington and Chelsea, Queenís Park and Paddington)",
        "codes": {
            "admin_district": "E09000020",
            "admin_county": "E99999999",
            "admin_ward": "E05009392",
            "parish": "E43000210",
            "ccg": "E38000202"
        }
    }
}

Part of the JSON is an "outcode": "W11", which I think is exactly what you are looking for.

You could also use the "eastings":524990,"northings":181250, fields to calculate the straight line distance from the restaurant to the user. The units are metres. Use Pythagoras.

🌐
Public-health-scotland
public-health-scotland.github.io › phsmethods › reference › format_postcode.html
Format a postcode — format_postcode • phsmethods
format_postcode takes a character string or vector of character strings. It extracts the input values which adhere to the standard UK postcode format (with or without spaces), assigns the appropriate amount of spacing to them (for both pc7 and pc8 formats) and ensures all letters are capitalised.