Skip to content
Distance & area

Distance between cities in Spain

Pick two cities or towns in Spain to see how many kilometers (or miles) separate them in a straight line and by road, and how long the drive takes.

Example From Madrid to Valencia. Change the points to measure your own.

Loading the map…

Straight line

Result

In a straight line

302km

Madrid → Valencia

Initial bearing
109° (E)
In the other unit
188 mi
Madrid
Population 3,506,730 (municipal register, 2025)
Valencia
Population 840,792 (municipal register, 2025)

By road

Tap a way to travel to see the distance and time along the route.

To give you an idea

60% of Madrid – Barcelona

Your trip302 km

Madrid – Barcelona506 km

Save or share this trip

How to use it

  1. Type the first town

    Start typing and pick from the list: it has the 3,152 Spanish municipalities with 1,000 residents or more, plus every provincial capital. Spanish and regional names both work (Alicante or Alacant, San Sebastián or Donostia), accents are optional, and so are a few English ones like Seville.

  2. Type the second one

    As soon as both are set, the map draws the straight line and the driving route. Use Swap to flip the trip around.

  3. Compare and share

    Read the straight-line and driving distance, the drive time and the bearing. Distances start in kilometers, the unit on every Spanish road sign; tap “mi” for miles and the tool remembers it.

What it’s for

  • Planning a trip around Spain

    See how far Seville is from Granada or Madrid from Toledo before choosing between a rental car, a coach or one of Spain’s high-speed trains.

  • Moving or studying

    Check how far the city you might move to, or your exchange university, is from the airport or from family in another region.

  • Work and quotes

    Work out the kilometers between clients, branches or warehouses for quotes, expense claims or a sales route.

  • Spanish class

    Use real distances between capitals to practice numbers and geography, and see why the road is always longer than the straight line.

How it’s calculated

Spain is divided into more than 8,100 municipalities (municipios), the local councils that run each town and its surrounding land. One municipality can include several villages, so the tool places each one at its main settlement: the point the Nomenclátor Geográfico of Spain’s National Geographic Institute (IGN) gives for the town center, usually near the town hall or the main church. Between the two points, Mapsfera measures the shortest line on the WGS84 ellipsoid with GeographicLib.

The driving distance comes live from the FOSSGIS OSRM routing service, using OpenStreetMap data: it’s the length of the fastest route by car (or bike, or on foot), which in Spain usually means the autovías, the free four-lane highways that fan out from Madrid.

As the crow flies

d = length of the geodesic between the two points (WGS84)

The straight-line distance: what a plane flying the shortest path would cover.

By road

d = sum of the legs of the fastest route

Worked out by OSRM on OpenStreetMap roads, using their speed limits (up to 120 km/h on Spanish highways).

Example: Madrid to Barcelona
Madrid 40.41903° N, 3.69198° W
Barcelona 41.38229° N, 2.17744° E
As the crow flies 506 km (314 mi)
By road Tap it in the tool: it’s calculated live

Population comes from the padrón, Spain’s official register of residents that every town council keeps: the figures are those of January 1, 2025, published by the National Statistics Institute (INE).

Distances between major Spanish cities

As the crow flies, between the town-center points of each city. Tap “See on the map” to open the pair in the tool and get the driving distance too.

CitiesKilometersMilesBearing See on the map
Madrid – Barcelona506 km314 mi76° E See on the map
Madrid – Valencia302 km188 mi109° E See on the map
Madrid – Sevilla391 km243 mi211° SW See on the map
Madrid – Zaragoza274 km170 mi59° NE See on the map
Madrid – Málaga415 km258 mi189° S See on the map
Madrid – Bilbao322 km200 mi11° N See on the map
Madrid – Alicante360 km224 mi129° SE See on the map
Madrid – A Coruña510 km317 mi312° NW See on the map
Madrid – Granada360 km224 mi179° S See on the map
Madrid – Salamanca177 km110 mi291° W See on the map
Madrid – Toledo68.6 km42.6 mi205° SW See on the map
Barcelona – Valencia303 km189 mi226° SW See on the map
Barcelona – Zaragoza257 km160 mi278° W See on the map
Barcelona – Bilbao469 km292 mi298° NW See on the map
Sevilla – Málaga159 km98.7 mi117° SE See on the map
Sevilla – Granada214 km133 mi96° E See on the map
Valencia – Alicante125 km77.8 mi184° S See on the map
Bilbao – San Sebastián76.4 km47.5 mi85° E See on the map
Oviedo – Gijón25.3 km15.7 mi36° NE See on the map
Vigo – Santiago de Compostela73.1 km45.4 mi12° N See on the map

Calculated on the WGS84 ellipsoid from IGN Nomenclátor points. Driving distances aren’t in the table because they change with roadwork and new highways: the tool calculates them on the spot.

Provinces, regions and city names

Under each town the list shows its province. Spain has 50 provinces, grouped into 17 autonomous communities (regions such as Andalusia or Catalonia), plus the autonomous cities of Ceuta and Melilla in North Africa. Several towns share a name, like the many Villanuevas, and the province is how you tell them apart.

In regions with a second official language, the official name may be bilingual or only in that language: València, A Coruña, Girona, Donostia/San Sebastián. The search accepts the Spanish form, the regional one and both together.

The Balearic and Canary Islands

Islands are measured the same way in a straight line: Barcelona – Palma: 205 km (128 mi), Valencia – Palma: 261 km (162 mi), Madrid – Las Palmas de Gran Canaria: 1,737 km (1,079 mi) and Las Palmas de Gran Canaria – Santa Cruz de Tenerife: 89.6 km (55.7 mi).

By road, the driving route uses the car ferries mapped in OpenStreetMap, such as those from Barcelona, Valencia or Dénia to the Balearic Islands, and adds the crossing to the distance. If no car ferry links the two places, the tool says there’s no road route and keeps the straight-line figure. Ferry times are rough: check the shipping line’s timetable.

Frequently asked questions

How many kilometers is it from Madrid to Barcelona?

506 km (314 mi) as the crow flies, between the center of Madrid and that of Barcelona. By road it’s farther: pick both cities above and the tool gives you the distance and the drive time.

Which towns are included?

The 3,152 municipalities with 1,000 or more registered residents in 2025, plus all provincial capitals and Ceuta and Melilla. For smaller villages, use the distance between two municipalities or the distance calculator.

What is a municipality in Spain?

The basic unit of local government, with its own town council (ayuntamiento). Its land, the término municipal, can hold a main town plus hamlets and housing estates. Each municipality has a five-digit INE code; the first two digits are its province.

Where in each town is the distance measured from?

From the IGN point for the municipality’s main town, usually in the old center. It isn’t the geographic middle of the municipality, which in large rural ones can be miles away from the town itself.

Can I see the distance in miles?

Yes. Spanish tools start in kilometers, as on road signs in Spain, but the km and mi buttons switch every figure, and your choice is kept for the other distance tools.

Is the driving route the shortest one?

It’s the fastest one according to OpenStreetMap speed limits, which usually means the autovía even if it adds a few kilometers. That’s why it may not match other navigation apps exactly.

Does it work offline?

The town search does: the list comes with the page and doesn’t ask any server. The map and the driving distance need a connection.

Related tools

All tools

Sources