Free tool ยท 149 countries

Postal code validator

Check whether a postal code has the right format for its country and whether it actually exists.

Two checks

  • Format: does the code match the country's pattern? Instant, in your browser.
  • Existence: is it a real code? Looked up in the zipcodestack database of 7 million codes.

Format and example

Pick a country to see its format.

Format rules for common countries

CountryFormatExample
United States5 digits, optional +410001, 10001-2062
United Kingdomoutward + inward codeSW1A 1AA
Canadaletter-digit-letter digit-letter-digitK1A 0B1
Germany5 digits10115
France5 digits75008
Netherlands4 digits + 2 letters1012 AB
India6 digits110001
Brazil8 digits (CEP)01310-100
Japan3 + 4 digits100-0001
Australia4 digits2000

All 149 formats, with the regex for each, are on the postal codes by country pages.

Validate postal codes by API

The postal code validation API page explains every field and what the check does and does not cover.

curl "https://api.zipcodestack.com/v1/validate?code=10001&country=us" -H "apikey: YOUR-API-KEY"

The response tells you whether the code exists (valid), whether the format is right (format_valid), the normalized code and the matching places.

Frequently asked questions

How do I check if a postal code is valid?

Pick the country, enter the code and click Validate. The tool first checks the format (e.g. five digits in the US, A9A 9A9 in Canada) and then looks the code up in our database to confirm that it exists and which place it belongs to.

Why is a code with the right format still invalid?

Not every combination is assigned. 00000 has the right US format but is not a ZIP code. Only a database lookup can tell real codes from well-formed fake ones.

Can I validate postal codes in my checkout or sign-up form?

Yes. Use the regex from the country pages for instant feedback and the zipcodestack API's /v1/validate endpoint to confirm the code exists and to prefill city and state.

Postal code API

Get this data in your app

zipcodestack looks up, validates and searches postal codes in 149 countries: city, state, coordinates, distances and radius search, as JSON.

/v1/validate documentation Postal code validation API All documentation

300 free requests every month. No credit card required.

GET https://api.zipcodestack.com/v1/validate?code=10001&country=us

{
  "results": {
    "10001": [{
      "postal_code": "10001",
      "country_code": "US",
      "latitude": 40.7484,
      "longitude": -73.9967,
      "city": "New York",
      "state": "New York",
      "state_code": "NY",
      "province": "New York"
    }]
  }
}

Free postal code tools

Start using our ZIP Code API for free today!

Get 300 requests / month for free