Skip to main content
The postcodes table contains 844,248 records covering 125 countries. Each record includes the postcode string, country, granularity type, source attribution, and locality name.

Coverage

StatValue
Total postcodes844,248
Countries covered125
Granularity types4 (full, outward, sector, district)

Postcode Types

TypeDescriptionExample
fullComplete postcode identifying a specific delivery point or small area90210 (US), 110001 (IN)
outwardFirst part of a UK-style postcode identifying the postal districtSW1A
sectorIntermediate granularity within a districtSW1A 1
districtBroadest level, covering an entire postal districtSW1

Query Examples

Look up postcodes for a country

SELECT postcode, locality_name, type
FROM postcodes
WHERE country_code = 'IN'
ORDER BY postcode
LIMIT 20;

Validate a postcode format

Use the postal_code_regex field on the countries table to validate a postcode before querying:
SELECT c.name, c.postal_code_format, c.postal_code_regex
FROM countries c
WHERE c.iso2 = 'GB';
-- postal_code_format: "@# #@@" or "@## #@@" etc.
-- postal_code_regex:  GIR[ ]?0AA|...

Find postcodes by locality

SELECT postcode, country_code, type, locality_name
FROM postcodes
WHERE country_code = 'GB'
  AND locality_name ILIKE '%London%'
ORDER BY type, postcode;

Count postcodes per country

SELECT country_code, COUNT(*) AS total, COUNT(DISTINCT type) AS types
FROM postcodes
GROUP BY country_code
ORDER BY total DESC
LIMIT 10;

Availability by Format

The postcodes table is included in all SQL-based exports (MySQL, PostgreSQL, SQLite, SQL Server) and the JSON export. It is not included in the CSV, YAML, or GeoJSON exports by default.
Use the Export Tool to download a postcodes-only dataset for specific countries, which is significantly smaller than the full dump.

Database Schema

Full table definitions including the postcodes table structure.

Export Tool

Export postcodes data in your preferred format.