Part of a Data Solution
- Explore →
Postal Codes Solution
Every worldwide postal-code dataset in one bundle — the ultimate global reference for precise postal codes.
Premium
You're viewing a free sample
Get the complete dataset — all rows and files — delivered instantly after checkout, with lifetime access to the latest version.
- Secure checkout via Stripe
- Instant download after payment
- Lifetime access to the latest version
- Creative Commons Attribution 4.0 license
API Access
Access dataset files directly from scripts, code, or AI agents.
Browse dataset files
API Access
Access dataset files directly from scripts, code, or AI agents.
Each file has a stable URL (r-link) that you can use directly in scripts, apps, or AI agents. These URLs are permanent and safe to hardcode.
Start with these files — they give you everything you need to understand and access the dataset.
- 1. Fetch datapackage.yml to inspect schema and resources
- 2. Download data resources listed in datapackage.yml
- 3. Read README.md for full context
Data Files
Postal Codes Data Resource for Spain, ES
| Field | Description | Title |
|---|---|---|
| country_code | ISO 3166-1 alpha-2 code for the country. | Country Code |
| postal_code | Postal code for the location. | Postal Code |
| place_name | Name of the city, town, or place. | Place Name |
| admin_name1 | Primary administrative division (e.g., state, region). | Administrative Name 1 |
| admin_code1 | Code for the primary administrative division. | Administrative Code 1 |
| admin_name2 | Secondary administrative division (e.g., county, district). | Administrative Name 2 |
| admin_code2 | Code for the secondary administrative division. | Administrative Code 2 |
| admin_name3 | Tertiary administrative division (e.g., municipality, borough). | Administrative Name 3 |
| admin_code3 | Code for the tertiary administrative division. | Administrative Code 3 |
| latitude | Latitude coordinate of the place. | Latitude |
| longitude | Longitude coordinate of the place. | Longitude |
| accuracy | Accuracy level of the latitude and longitude coordinates. | Accuracy |
| alternative_city_name | Alternative name(s) for the city or place. | Alternative City Name |
Download
Download sample CSVAbout
- Last updated
- 7 November 2024
- Total rows
- ...
- Format
- CSV
- File size
- 8.8 kB
- Sources
- CartoCiudad, Instituto Geografico Nacional / CNIG (Obra derivada de CartoCiudad 2026 CC-BY 4.0 scne.es) - postal code to municipality relations and per-postal-code coordinates
- Relacion de municipios y sus codigos por provincias, Instituto Nacional de Estadistica (INE), updated 2026-01-01 - Elaboracion propia con datos extraidos del sitio web del INE; the INE neither participates in nor endorses this dataset
- GeoNames (CC BY 4.0) - independent cross-check and locality names; see README.md for the multi-municipality, cross-province-routing and accuracy-tier notes
About this dataset
Postal Codes Dataset for Spain (ES)
This dataset contains Spanish postal codes (códigos postales) — 14,538 rows covering 11,142 distinct five-digit codes across all 19 autonomous communities, all 52 provinces and all 8,132 municipalities. Every row carries the official INE administrative codes at all three tiers and a coordinate.
Note: This dataset is a sample containing the first 100 rows. If you need access to the complete dataset, please contact our sales team for more information: datahub@datopian.com
Granularity note
A postal code is not one-to-one with a municipality. 2,108 codes span more than one
municipality (up to 10, for 09640), while a large city holds many codes — Madrid alone has
over 200. The primary key is (postal_code, admin_code3), never postal_code alone;
joining on the code by itself will fan out.
Administrative codes
admin_code1 is the ISO 3166-2:ES autonomous-community code with the ES- prefix stripped
(AN, CT, MD…). admin_code2 is the INE province code 01–52. admin_code3 is the
INE five-digit municipality code (CPRO+CMUN) — the standard join key for Spanish
statistical, cadastral and electoral data. All three are strings with significant leading
zeros: read them with dtype=str or through the Data Package schema, or 04013 will
silently become 4013.
The postal prefix is not always the province
A code's first two digits identify the serving post office, not the municipality's
province. In 40 rows the two legitimately differ: Condado de Treviño is a Burgos enclave
entirely surrounded by Álava and carries 01118; Petilla de Aragón is a Navarrese exclave
inside Zaragoza and carries 50686; Tresviso is in Cantabria but its only road reaches the
network through Asturias, so it carries 33554. admin_name2 / admin_code2 always give
the municipality's real province. For the routing province, take the code's first two
digits.
Coordinate accuracy
accuracy states where each point came from, and there are two tiers:
POSTAL_CODE(14,250 rows) — resolved for that individual five-digit code.MUNICIPALITY(288 rows) — PO-box and large-customer ranges (XX070,XX071,XX080, plus installation codes such as a nuclear plant and an airport). These have no street geography, so no per-code point exists for them anywhere; the point is the median of the per-code points resolved inside their municipality.
Coordinates are WGS84 / EPSG:4326, decimal degrees, 5 decimal places. No coordinate is interpolated or invented, and none is carried over from a source that could not be verified.
Municipality names
Names are given in natural reading order. The Spanish statistical register writes
Coruña, A and Madrid, Comunidad de; this dataset ships A Coruña and
Comunidad de Madrid, keeping the register form in alternative_city_name. Bilingual
official names are preserved in full (Alacant/Alicante, Araba/Álava).
Known omissions
Twelve postal codes assigned to individual hamlets and installations are not included
(03459, 10150, 15591, 19131, 28851, 34260, 37467, 37608, 43518, 43729,
45489, 50176). No open source states which municipality they belong to, and two carry a
postal prefix from a different province than their name suggests, so assigning one would be
a guess.
Data Sources
- Obra derivada de CartoCiudad 2026 CC-BY 4.0 scne.es — Instituto Geográfico Nacional / CNIG, under Orden FOM/2807/2015.
- Elaboración propia con datos extraídos del sitio web del INE: www.ine.es — Relación de municipios y sus códigos por provincias, updated 2026-01-01. The INE neither participates in nor endorses this dataset.
- © GeoNames, CC BY 4.0 — independent cross-check and locality names.
All sources are CC BY 4.0 and this dataset is distributed under the same licence. No share-alike source (OpenStreetMap, Wikipedia) was used, so nothing here is encumbered by ODbL or CC BY-SA.
Usage
The dataset files are available in CSV format and can be accessed and downloaded using the links provided in the datapackage.yml.
For access to the full dataset or other inquiries, please contact our sales team at datahub@datopian.com