
Two countries share a long land border with Morocco: Algeria to the east and Mauritania to the south. In the north there is also a short land border with Spain, which otherwise sits 14 km away across the Strait of Gibraltar. The rest of the frontier is water: the Mediterranean to the north and the Atlantic to the west.
People look up the countries bordering Morocco for two very different reasons. Some are settling a geography question. Others are standing in Seville or Tarifa with a week left and wondering how close Africa really is. This page answers both, and it says plainly which borders a traveller can actually cross.

The countries bordering Morocco, in shortContents ↑
Morocco sits at the north-west corner of Africa, and its outline is easier to remember than most. East is Algeria. South is Mauritania. North is the Mediterranean, with Spain on the far shore and a short land border on the near one. West is the Atlantic, all the way down.
That makes Morocco one of the few countries on the continent with both an Atlantic and a Mediterranean coast, about 3,500 km of shoreline in total. If you want the wider picture of where the country sits on the globe, our page on where Morocco is on the map goes through it with distances.
| Neighbour | Direction | Kind of border | How travellers cross |
|---|---|---|---|
| Algeria | East | Land | By air only |
| Mauritania | South | Land | By road, far south |
| Spain | North | Sea and short land border | Ferry or flight |
| Portugal | North-west, by sea | No shared border | Flight |
Algeria, the neighbour to the eastContents ↑
The border with Algeria is the longest one Morocco has. It starts on the Mediterranean near Saidia, runs south past Oujda and Figuig, then follows the desert toward the far south-east.
For a traveller, the practical fact is simple: the land border has been closed since 1994, so nobody drives or walks across. People who visit both countries fly, usually through Casablanca. That is worth knowing before you sketch a Maghreb road trip, because the line between Oujda and Tlemcen looks like an hour’s drive and is in reality a flight with a connection.
On a map, the closed border can make the east of Morocco look like a dead end. For travellers it is the opposite. Merzouga lies about 50 km from that border, at the foot of Erg Chebbi, the great sea of dunes most people picture when they think of the Moroccan Sahara. For a first desert trip it is the one we recommend: high dunes, camps a short camel ride from the village, and a sunrise over the sand that people remember long after.
Getting there from Marrakech means crossing the High Atlas, which is why our three-day private desert trip from Marrakech to Merzouga spreads the road over three days with stops along the way. If you would rather shape your own route, adding Fes or another night in the dunes for example, Mouhssine can build it with you: the WhatsApp button is at the end of this page.
Mauritania, the neighbour to the southContents ↑
Follow the Atlantic coast south from Agadir and you pass Tan-Tan, Laayoune and Dakhla before you reach the end of the country near Lagouira. Mauritania begins there.
This is the border overland travellers use. The road south from Dakhla leads to the crossing at Guerguerat, the gateway for people driving on to Nouakchott and West Africa. It is a long haul. Dakhla alone is around 1,400 km from Marrakech by road, so most visitors who want the lagoon and the wind fly there instead.

Spain, 14 kilometres across the waterContents ↑
Spain is the neighbour most visitors meet first. At its narrowest the Strait of Gibraltar is 14 km wide, and on a clear day you can pick out buildings on the opposite shore from the hills above Tangier. Morocco and Spain also share a short land border on the northern coast.
Ferries make this the easiest frontier in the region. Fast boats link Tarifa with Tangier’s city port in about an hour, while larger ferries run between Algeciras and Tanger Med, a port some 45 km east of the city. Sailings stop when the wind is strong in the strait, which happens more often than first-time visitors expect.
MoroccoAfricaStrait of GibraltarMediterranean SeaAtlantic Ocean →GibraltarFerries to Tanger MedPort of AlgecirasTanger Med and Tangier→west of this viewTarifa→narrowest point, 14 kmSpainEuropeIf you are arriving from Andalusia, the full breakdown of ferries, timings and what to do on arrival is in our guide to travelling to Morocco from Spain.
The Canary Islands, off the southern coast
Spain is also a neighbour by sea much further south. The Canary Islands lie in the Atlantic about 100 km off the Moroccan coast near Tarfaya, which is why the two share the same trade winds that kitesurfers come to Dakhla for.
The two seas that close the mapContents ↑
North and west, Morocco has no neighbour but water. The Mediterranean coast is the short one, rocky and warm, running from the strait east to Saidia. The Atlantic coast is the long one, cooler and windier, with Rabat, Casablanca, Essaouira, Agadir and Dakhla strung along it.
The difference matters when you choose a beach. Mediterranean water is calm and warm in summer. The Atlantic stays fresh even in August and has real surf. Our page on Morocco’s mountains, coasts and desert explains how the two coasts and the Atlas ranges shape the climate.

Countries near Morocco that do not share a borderContents ↑
Several countries are close without touching Morocco.
- Portugal is the second-closest European country after Spain, a short flight from Casablanca or Marrakech.
- Tunisia and Libya belong to the same Maghreb region but lie beyond Algeria.
- Senegal and Mali are the next countries south and east of Mauritania.
- Gibraltar faces Morocco across the strait, next to the Spanish coast.
One confusion comes up often: Morocco is in Africa, not in the Middle East and not in Europe, even though Rabat is far closer to Madrid than to Cairo. We cover that question separately in is Morocco in Africa.
What the borders mean for planning a tripContents ↑
In practice, only one frontier shapes most itineraries: the strait. A week split between Andalusia and northern Morocco works well, with Tangier, Tetouan and Chefchaouen all within reach of the ferry. Tangier is also the northern end of the high-speed line, so the Al Boraq train puts Rabat and Casablanca a couple of hours from the port.
Combining Morocco with Algeria in one overland trip does not work, for the reason given above. Combining it with Mauritania is possible, but it belongs to a long overland journey, not a holiday.
Border rules and ferry schedules change. Check the port’s official site and your own foreign ministry’s advice in the week before you travel.
Mistakes people make reading the mapContents ↑
The first is scale. Morocco covers 710,850 square kilometres and stretches a long way from north to south, so Tangier and Dakhla are not a day apart by road. The second is assuming every line on the map is a crossing. Only the Spanish and Mauritanian borders are open to travellers. The third is forgetting the mountains: the Atlas ranges sit between the coast and the desert, and they add hours to any route that looks short on paper.
Rental car, bus or private driver
Those mountain hours are where the choice of transport shows. Behind the wheel of a rental car you spend them reading signs on unfamiliar passes, looking for fuel and parking, and stopping because you are tired rather than because the view is good. Buses are cheap and reliable between the big cities, but they run on fixed timetables and connections eat the day. A private driver with a licensed guide plans the route around the road and the season, and puts the stops where they are worth making, so the hours on the road become part of the trip. Our guide to hiring a reliable driver covers what to check before you book.
| Question | Rental car | Bus | Private driver and guide |
|---|---|---|---|
| Who drives the mountain roads | You | The bus driver | A professional who drives them every week |
| Route and stops | You plan everything | Set by the timetable | Built around you and the road |
| Where time is lost | Navigation, fuel, parking | Waits and connections | Kept to a minimum |
| What you learn on the way | What you read beforehand | Very little | Explained as you travel |
| Best for | Confident drivers with time | Tight budgets, city to city | First visits, mountains and desert |
Who guides you. Mouhssine ELIOUJ is a licensed tourist guide based in Marrakech. Tours in the mountains and other natural areas are run together with licensed local guides from those regions, who know the trails, the weather and the villages first-hand. More on hiring a licensed guide in Marrakech.
Questions travellers ask about Morocco’s bordersContents ↑
How many countries border Morocco?
Three share a land border with Morocco: Algeria, Mauritania and, over a short stretch in the north, Spain. Algeria and Mauritania account for almost all of the land frontier. Everything else is coastline on the Mediterranean and the Atlantic.
Can you cross from Morocco to Algeria by land?
No. The land border between Morocco and Algeria has been closed since 1994. Travellers who want to visit both countries fly, and there is no bus, train or road crossing to plan around.
Which country is closest to Morocco?
Spain. The Strait of Gibraltar is only 14 km wide at its narrowest point, and fast ferries from Tarifa reach Tangier in about an hour when the weather allows.
Is it easy to visit Morocco from Spain for a few days?
Yes, if you stay in the north. Tangier, Tetouan and Chefchaouen fit a three or four day trip from Andalusia. Marrakech and the desert are too far for that, and they deserve a separate visit with a flight.
Can you drive from Morocco to Mauritania?
Yes. The road runs south from Dakhla to the crossing at Guerguerat. It is a very long drive from the main tourist cities, so check the entry rules for Mauritania and the road conditions before you set out.
Does Morocco border Portugal?
No. Portugal is close by sea and by air but shares no border with Morocco. Most people travel between the two by plane.
From the borders to a routeContents ↑
Knowing the neighbours helps most at the planning stage. Arrive by ferry and the north is your natural start. Arrive by air in Marrakech and the Atlas and the Sahara are closer than the Mediterranean will ever be. For many first visits the best use of that position is the classic run from Marrakech over the mountains to the dunes, the route described in the Algeria section above. If your dates or interests call for something else, our plan your trip page is the place to start.

- Official portal of the Kingdom of Morocco: area of the country and length of its coasts
- Tanger Med Port Authority and Tangier city port: ferry terminals on the strait
Figures are those published by the Moroccan authorities. Border and ferry conditions can change, so check before you travel.



