Postal Codes Dataset for Spain, ES

419
0
Updated:
Files:1
Size:8.8 kB
Formats:csv
License:CC-BY-4.0

Postal Codes Dataset for Spain, ES including name of the city, town, or place, various administrative divisions and alternative city names.

Part of a Data Solution

  • Postal Codes Solution

    Every worldwide postal-code dataset in one bundle — the ultimate global reference for precise postal codes.

    Explore →

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
10% off
$49.90$44.91
one-time payment

API Access

Access dataset files directly from scripts, code, or AI agents.

Browse dataset files
Dataset Files

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.

/logistics/postal-codes-es/
https://datahub.io/logistics/postal-codes-es/_r/-/.licensing-notes.md
https://datahub.io/logistics/postal-codes-es/_r/-/README.md
https://datahub.io/logistics/postal-codes-es/_r/-/datapackage.yml
Key Files

Start with these files — they give you everything you need to understand and access the dataset.

datapackage.ymlmetadata & schema
https://datahub.io/logistics/postal-codes-es/_r/-/datapackage.yml
README.mddocumentation
https://datahub.io/logistics/postal-codes-es/_r/-/README.md
Typical Usage
  1. 1. Fetch datapackage.yml to inspect schema and resources
  2. 2. Download data resources listed in datapackage.yml
  3. 3. Read README.md for full context

Data Files

Postal Codes Data Resource for Spain, ES


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 0152. 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.esRelació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