Book Your Morocco Train Ticket Online: A Short Guide
Travelling by train is an excellent way to get around Morocco, but booking tickets online in advance can be difficult, as the official ONCF (Moroccan Railways) website is often inaccessible.
If you encounter problems using the ONCF website, here are the best online alternatives for booking your train ticket.
The problems with the ONCF website
The official ONCF website is fairly straightforward to use for booking train tickets, but unfortunately it is inaccessible from roughly half the world.
For reasons that remain unclear, Moroccan Railways has chosen to geoblock dozens of countries from accessing the ONCF website.
If the ONCF website does not load in your internet browser, rest assured the problem is not on your end but is caused by its aggressive firewall blocking your access.
Of course, you can get around this problem by using a VPN to access the ONCF website, setting it to Morocco or another country from where access is permitted (it works from Spain, for example).
If you are not very tech-savvy and do not know how to use a VPN, there is no need to worry, as there are a couple of other great alternatives for booking the Moroccan train tickets you need for your trip!

Book your Moroccan train ticket through another reliable platform
The best alternative for booking your train if the ONCF website is not working is to use a reliable online booking platform that can access the Moroccan Railways ticketing system and secure the tickets you need.
By far the best website to book your train tickets in Morocco is the reliable online booking platform 12Go.
12Go can book all your Moroccan train tickets, including the premium Al Boraq high-speed trains, Al Atlas InterCity trains, and even regional services.
Whether you are looking to book a train between Casablanca and Marrakech or want to travel to cities such as Fez or Tangier, 12Go can book it all.
Another advantage of using 12Go is that a single search lets you compare trains with other transport options in Morocco, such as long-distance buses, private taxis and car transfers, and even domestic flights, and the website accepts all foreign debit and credit cards.
Buy tickets at the station
Of course, another option is to simply buy the train tickets you need at the station once you arrive in Morocco.
If you are flexible with your schedule and don’t mind taking a later train or travelling in a different class if your preferred option is fully booked, this should not be a problem.
Stations in major Moroccan cities such as Casablanca, Tangier, Marrakech, Fez, and Rabat all have staffed ticket offices with employees experienced in dealing with tourists.
Even if you do not speak a word of Arabic (or French, which is also useful in Morocco), buying your tickets at the station is a straightforward process.
However, if you are the kind of traveller who has a fixed itinerary, or one who wants the peace of mind of having everything booked in advance, it is better to reserve your Moroccan train tickets ahead of time using 12Go or a similar online booking platform, as outlined above.

Is it necessary to book Moroccan trains in advance?
Keep in mind that Moroccan long-distance trains (Al Boraq high-speed trains and Al Atlas InterCity trains) require mandatory seat reservations, which come automatically included with your ticket.
Once all seats are sold, there is no way to travel on these trains, so your only option is to book a ticket for the next train with available seats.
Although this does not always occur, it is fairly common for peak train services on popular routes to sell out, especially during the busy tourist season and around national or religious holidays.
Only regional and commuter train services, such as the Casablanca Airport Train, do not have seat reservations and therefore cannot sell out.
Tickets for these trains can be bought just as easily at the station as online, as there is no real need to book in advance, although it is of course convenient to have your ticket before arriving in Morocco so you don’t need to waste time queuing at the ticket office.

Conclusion
It is a pleasure to get around Morocco by train, though booking your tickets in advance from abroad can be difficult, as the official Moroccan Railways (ONCF) website geoblocks more than half of the countries in the world.
Fortunately, there are ways to book Moroccan train tickets if you cannot access the ONCF website.
You can either use a VPN set to Morocco or a country not geoblocked by ONCF, or book your tickets through a reliable online platform such as 12Go.
Of course, you can also buy your tickets at the station once you arrive in Morocco, though keep in mind that trains can sell out in advance.
This is particularly the case during peak tourist season or on national and religious holidays, when it is advisable to book your tickets online in advance rather than on the day of travel at the station.

One thing you don’t mention is that mobile phones typically connect as if they are in their home country. So if the ONCF web site is blocked in your home country then it will likely still be blocked for your mobile phone when you are in Morocco unless you connect to WiFi or get a Moroccan SIM. I’ve not been to Morocco but I’ve had this in Poland.