Wayfarly
Morocco by Train: How to See Marrakech, Fez, and the Coast Without Flying

Guide

Morocco by Train: How to See Marrakech, Fez, and the Coast Without Flying

Morocco's ONCF rail network connects Marrakech, Fez, Casablanca, and Tangier on real, reliable trains — but Essaouira and Chefchaouen sit off the rail map entirely, and knowing that before booking saves a wasted afternoon at the wrong station.

Morocco's national rail operator, ONCF, runs a genuinely functional network along the country's main population corridor, and it's a far better option than most first-time visitors expect from a country not typically associated with European-style rail travel. The catch is that the network follows a specific line, Tangier through Casablanca down to Marrakech, with a branch east to Fez and Meknes, and several of Morocco's most photographed towns sit entirely outside it.

The core route: Tangier to Marrakech

Al Boraq, Africa's first high-speed line, opened in 2018 and cuts the Tangier-to-Casablanca run to around 2 hours 10 minutes at speeds up to 320 km/h, a genuine leap from the roughly 5-hour drive the same route takes by car. South of Casablanca, standard rail continues to Marrakech, adding around 2 hours 45 minutes more. Tickets are bookable through ONCF's own site, and first class is worth the modest upcharge on longer legs for guaranteed seating and more legroom.

Marrakech to Fez: the long way across

The direct train between Marrakech and Fez runs close to 7 hours, routing back up through Casablanca rather than cutting directly east, since no rail line crosses the Atlas Mountains between the two cities. That's a full travel day, worth weighing honestly against Morocco's domestic flight network, which covers the same distance in under an hour, plus airport transfer and security time on both ends. For travelers who'd rather see the countryside than save the hours, the train remains a genuinely pleasant option; for a tight itinerary, flying is the more practical call.

Where the rail network stops

Essaouira has no train station. The Atlantic coastal town, known for its walled medina and consistent wind that's made it a windsurfing draw for decades, connects to Marrakech only by bus or grand taxi, a shared-ride system running fixed routes in older Mercedes sedans or larger vans, typically taking 2 to 3 hours. Chefchaouen, Morocco's blue-painted mountain town in the Rif range, sits in a similar position, reachable from Fez or Tangier by bus (CTM is the more reliable operator) rather than rail, generally 4 to 5 hours depending on the route.

Building a realistic itinerary

A rail-anchored Morocco trip works best structured as Tangier or Casablanca as the entry point, Al Boraq or standard rail down to Marrakech, then deliberate bus legs out to Essaouira and back before flying or taking the long train to Fez, with a further bus connection to Chefchaouen if time allows. Trying to force the whole country onto rail alone means either skipping Essaouira and Chefchaouen entirely or accepting that a meaningful part of the trip will happen on a bus regardless of how the rest is planned.

The practical version

Book ONCF tickets online in advance for the Al Boraq line specifically, since that route sees the heaviest demand; standard rail tickets are generally available at the station same-day without much price difference for booking ahead. Grand taxis operate on a fill-the-car basis at fixed per-seat rates, cheaper than a private taxi but with less schedule certainty, worth budgeting extra time around rather than cutting connections close.

Frequently asked questions

Can you travel around Morocco entirely by train?

Mostly, but not entirely. Morocco's ONCF network covers the country's main axis well, Tangier, Casablanca, Rabat, Marrakech, and Fez, but towns like Essaouira and Chefchaouen have no rail station at all and require a bus or shared taxi (grand taxi) for the final leg.

How long does the train take from Marrakech to Fez?

The direct train between Marrakech and Fez takes around 7 hours, running through Casablanca. It's a full day of travel by train, and worth weighing against Morocco's domestic flight options, which cover the same route in under an hour but add airport time on both ends.

What is Al Boraq?

Al Boraq is Africa's first high-speed rail line, running between Tangier and Casablanca since 2018 at speeds up to 320 km/h, cutting a roughly 5-hour drive down to about 2 hours 10 minutes. It's currently limited to that single corridor rather than extending across the whole network.

Do you need a car in Morocco if you're taking trains?

Not necessarily, but flexibility drops without one. Grand taxis, shared vehicles running fixed routes between towns, fill in most of the gaps the rail network leaves, and they're a normal, well-established part of how Moroccans themselves get around beyond the train corridors.

Destinations mentioned in this guide