Postal code

Spain postal codes

Spain postal codes have the format ##### (5 digits), for example 28039. zipcodestack has 38,347 postal codes for Spain in 19 regions.

Format
#####
Example
28039
Codes in our database
38,347
Local name
código postal

Spain postal code format

Pattern##### (# digit, @ letter)
Examples28039, 28300, 28070
Regex^(?:\d{5})$
Official lookupwww.correos.es

Format and regex from Google's address metadata (libaddressinput). The regex checks the shape of a code, not whether it exists.

Postal Codes by region

RegionRangeCodes
Andalucia04001 – 419891,237
Aragon22001 – 50840767
Asturias33001 – 33997420
Baleares07001 – 07872164
Canarias35001 – 38917368
Cantabria33554 – 39880215
Castilla - La Mancha02001 – 45960866
Castilla - Leon01118 – 498822,020
Cataluna08001 – 438971,163
Ceuta51001 – 510808
Comunidad Valenciana03001 – 46989657
Extremadura06001 – 13110466
Galicia15001 – 369951,540
La Rioja26001 – 26589132
Madrid28001 – 28991323
Melilla52001 – 520809
Murcia03657 – 30893213
Navarra31001 – 50686266
Pais Vasco01001 – 48998333

Postal Codes of the largest cities

Neighbouring countries

Spain postal codes: FAQ

What is the postal code format in Spain?

Spain postal codes follow the pattern ##### (# = digit, @ = letter), i.e. 5 digits. Examples: 28039, 28300, 28070.

What regex validates Spain postal codes?

^(?:\d{5})$ matches the official format (from Google's address metadata). It checks the shape only; whether a code exists needs a lookup in a postal code database such as the zipcodestack API.

What is the postal code of Madrid?

Madrid has 63 postal codes, starting with 28001. The right one depends on the street; see the full list for Madrid.

How many postal codes are there in Spain?

The zipcodestack database contains 38,347 postal codes for Spain, each with place name, region and coordinates.

Postal code API

Look up Spain postal codes by API

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

/v1/search documentation International postal code API All documentation

300 free requests every month. No credit card required.

GET https://api.zipcodestack.com/v1/search?codes=28039&country=es

{
  "results": {
    "28039": [{
      "postal_code": "28039",
      "country_code": "ES",
      "city": "…",
      "state": "…",
      "latitude": …,
      "longitude": …
    }]
  }
}

Free postal code tools

Start using our ZIP Code API for free today!

Get 300 requests / month for free