How a Spanish address is written
Spanish addresses start with the street type and name, then the number after a comma, then the floor and door: Calle de los Olivos, 24, 3º B. The next line has the five-digit postcode followed by the town (28013 Madrid); when the town is not the provincial capital, the province is often added in brackets (08800 Vilanova i la Geltrú (Barcelona)). Correos also accepts the province on its own line.
Floor and door codes have their own vocabulary: Bajo (ground floor), Entlo. (mezzanine), Ático (top floor), Izq./Dcha. (left/right door) and the ordinal sign º (3º). Rural addresses may use s/n (sin número) or a kilometre point (Ctra. N-340, km 12).
Código postal structure
Spanish postcodes have five digits. The first two are the province number, from 01 (Álava) to 50 (Zaragoza) in alphabetical order of the old Spanish names, plus 51 Ceuta and 52 Melilla. The last three identify the delivery area; in a provincial capital they usually start with 0 (28013 central Madrid).
- A strict check is
^(0[1-9]|[1-4]\d|5[0-2])\d{3}$, which rejects00xxxand53xxx–99xxx. - Leading zeros: Barcelona
08001, Alicante03001, Palma07001. Store as text. - Because the prefix is the province, you can pre-fill or cross-check the province from the postcode.
Comunidades autónomas and provinces
Spain has 17 autonomous communities and two autonomous cities (Ceuta and Melilla), divided into 50 provinces. Addresses use the province, not the community. Many places have official names in two languages — A Coruña, Girona, Lleida, Vitoria-Gasteiz, Illes Balears — and users type either version, so match on the postcode rather than on the name.
Testing tips for Spanish address forms
- Give floor and door their own fields or accept them on the street line; test
3º B,Bajo Izq.andÁtico. - Accept the characters ñ, º, ª and accented vowels (
Logroño,Málaga). - Allow two surnames in the name fields: Spanish users normally have both.
- The Canary Islands (postcodes
35and38), Ceuta and Melilla are outside the EU VAT area; test that your tax logic handles them.
Building a Spanish test data set
Include addresses from the mainland, the Balearic and Canary Islands, and Ceuta or Melilla in one batch. The islands and the autonomous cities have different shipping costs and tax rules, and the leading-zero provinces (Barcelona, Alicante, Palma) catch postcodes stored as numbers. Combine the addresses with Spanish names that have two surnames, and check that your invoices, labels and CSV exports keep the floor and door details (3º B) on the same line as the street.
What makes these addresses fictional
Cities, communities and postcode prefixes are real; street names are built from generic words (Olivos, Fuente, Mayor) and numbers are random, so any match with a real address is coincidental. Use the data only for testing and development.
Autonomous communities and cities of Spain
The generator uses the 19 first-level autonomous communities and cities below, with the codes used in addresses. Cities are picked from 23 places spread across the country, each with postcodes from its own range.
- ANAndalucía
- ARAragón
- ASPrincipado de Asturias
- IBIlles Balears
- CNCanarias
- CBCantabria
- CLCastilla y León
- CMCastilla-La Mancha
- CTCataluña
- VCComunitat Valenciana
- EXExtremadura
- GAGalicia
- MDComunidad de Madrid
- MCRegión de Murcia
- NCComunidad Foral de Navarra
- PVPaís Vasco
- RILa Rioja
- CECeuta
- MLMelilla
Example Spain test addresses
28013 Madrid
Spain
29016 Málaga
Spain
Validation pattern used for the Código postal: ^(0[1-9]|[1-4]\d|5[0-2])\d{3}$. It checks the format only — whether a code is actually in use is known only to the postal operator.
Phone numbers in Spain test data
Spanish numbers have nine digits with no trunk prefix (91 123 45 67 landline, 6xx xx xx xx mobile; +34 internationally). No official fictional range is published that we know of, so the generator leaves the phone blank rather than invent numbers that could belong to someone.
Sources
Postcode ranges, region lists and address conventions checked against these sources in October 2026. Street names in the generator are synthetic.
Other countries: United StatesUnited KingdomCanadaAustraliaIndiaGermanyFranceItalyNetherlandsBrazilMexicoJapanPhilippinesPakistanNigeriaSouth AfricaTurkeyIndonesiaUnited Arab Emirates
Frequently asked questions
What is the format of a Spanish address?
Street type, name, number, floor and door on one line (Calle de los Olivos, 24, 3º B), then the 5-digit postcode and the town (28013 Madrid).
What do the first two digits of a Spanish postcode mean?
They are the province number: 28 Madrid, 08 Barcelona, 41 Sevilla, 46 Valencia, up to 52 for Melilla.
Does the generator create Spanish phone numbers?
No. We know of no officially reserved fictional range in Spain, so the phone field stays blank instead of producing numbers that might be in use.
Is this a real address in Spain?
No. The city, comunidad autónoma and postcode format are real, but the street and house number are random. Use the addresses for testing forms, databases and shipping-rate logic, never to send mail or goods.