Postal code guides
Guides on postal code validation, ZIP code distances in Excel, choosing a ZIP code API and when to use a database download instead.
Guide
ZIP code database vs API
Download a ZIP code database or call a ZIP code API? Setup, updates, coverage, speed, cost and licences compared, with free sources and a caching pattern.
Tutorial · JavaScript, Python, PHP
Postal code regex for 20 countries, tested
Postal code regex for the US, UK, Canada, Germany and 16 more countries, tested on 3.7 million real codes, with code in JavaScript, Python and PHP.
Tutorial · Excel & Google Sheets
Distance between ZIP codes in Excel
Calculate the distance between ZIP codes in Excel or Google Sheets: a tested haversine formula, coordinate lookups with XLOOKUP, and live distances from an API.
Comparison
Best ZIP code APIs in 2026, compared
The best ZIP code API for your project: zipcodestack, Zipcodebase, Smarty, USPS, GeoNames, Google and more compared on coverage, free tier and price per 1,000.
Postal code API
Get this data in your app
zipcodestack looks up, validates and searches postal codes in 182 countries: city, state, coordinates, distances and radius search, as JSON.
/v1/search documentation International postal code API All documentation
1,000 free requests every month. No credit card required.
GET https://api.zipcodestack.com/v1/search?codes=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"
}]
}
}