China Travel › Train routes › Shanghai to Dunhuang by train

China Travel · Trains

Shanghai to Dunhuang by Train (2026): Times, Fares and Booking

No direct train, so the route comes in two legs — where to change, how long each part takes, and the 15-day booking window · Updated September 2026

Short answer

There is no direct train from Shanghai to Dunhuang. Dunhuang sits at the end of a 169 km branch line off the Lanzhou–Xinjiang corridor, and it is a terminus, not a stop on a through route, so the trip is always two legs with a change in Gansu: Shanghai to Lanzhou, then Lanzhou to Dunhuang.

Route listings put the whole thing at roughly 25 to 35 hours of rail travel. In practice that is a long day on a high-speed train plus one night, or two nights if you take conventional sleepers on both legs. The second leg is listed at about 8.5 to 14.5 hours from Lanzhou depending on the train.

Since the two legs are two separate tickets, the sensible version of this trip adds a night in Lanzhou rather than gambling on a same-day connection. If your trip is short, fly — route listings quote 6 to 9 hours for flights, usually with a stopover. The train earns its place when you want the Hexi Corridor out of the window.

Why there is no direct train

Shanghai to Dunhuang looks like one line on a map and is two in the timetable. The trunk line across Gansu is the Lanzhou–Xinjiang railway, and Dunhuang is not on it. The city is served by the Dunhuang railway, a 169 km branch from Liugou (柳沟) in Guazhou County, which opened with its first service in March 2006. A second line heads south from Dunhuang towards Golmud, a 671 km route finished at the end of 2019, which connects the area to western Qinghai rather than to the east coast.

Branches get fewer trains than trunks. That is the whole explanation: a handful of Dunhuang-bound services a day, shared among everyone travelling from Lanzhou, Xi'an, Beijing and Shanghai. Almost nobody rides one end to end from the coast.

The upside of a branch line Trains that do run the branch are usually quiet after Lanzhou, and the last 169 km through the desert edge is the most photogenic part of the whole trip. The trade you are making is scarcity, not scenery.

The route in two legs

LegStationsTypical journey timeClasses sold
Leg one: Shanghai to Lanzhou Shanghai Hongqiao (上海虹桥站) for high-speed; Shanghai Railway Station (上海站) for conventional sleepers → Lanzhou West (兰州西站) or Lanzhou (兰州站) A full day by high-speed train, or a night on a conventional sleeper Second class, first class, and soft / hard sleeper on the conventional trains
Leg two: Lanzhou to Dunhuang Lanzhou West or Lanzhou → Dunhuang (敦煌站) Listed at about 8.5 to 14.5 hours depending on the train Second class and first class seats; soft sleeper, hard sleeper and hard seat on the conventional services
Total One change in Gansu Roughly 25 to 35 hours of rail travel as listed Two separate tickets

Route listings put Lanzhou and Dunhuang about 1,095 km apart, which is why the second leg is a serious journey rather than an afternoon hop, and why an overnight train on that stretch saves a hotel night without costing you a day.

Which station in Shanghai

Shanghai has several stations and they are not close to one another. The departure station is printed on the ticket — read it before you order a taxi.

StationTrains that use it on this routeNotes
Shanghai Hongqiao Railway Station (上海虹桥站) The high-speed G and D services heading west Attached to Hongqiao airport and on metro lines 2, 10 and 17. The busiest of the group.
Shanghai Railway Station (上海站) Conventional Z, T and K sleepers Central, on metro lines 1, 3 and 4. The station to use if you are taking the overnight train.
Shanghai South Railway Station (上海南站) Mostly services to the south and south-west Rarely relevant to a Gansu trip, but it appears in some search results — check the station code, not the city name.

Where to make the change

There is more than one correct answer here, and the best one depends on whether you want to break the journey or get it over with.

Change atWhyWhat it costs you
Lanzhou (Lanzhou West or Lanzhou station) Every Dunhuang-bound train passes through, so this has the widest choice of onward services A night in the city, and a move between two stations if your arrival and departure stations differ
Jiayuguan South (嘉峪关南站) The remaining hop to Dunhuang is only about 2.5 to 3 hours on the high-speed services You still have to reach Jiayuguan first, usually via Lanzhou
Zhangye West (张掖西站) Puts the Danxia landform and the corridor oases on the itinerary Same as above, plus one more intermediate stop to plan

Lanzhou is where the two Lanzhou stations matter. High-speed arrivals pull into Lanzhou West, while many conventional trains use the older central station, so a change that looks like a simple transfer online can mean crossing the city. Allow an hour or two if your booking does that to you.

Same-day connections on this route are a bad bet Two tickets mean two journeys. If the Shanghai leg runs late — weather, congestion, a long signal wait in Gansu — the Dunhuang train leaves without you and the second ticket is not automatically refunded. Overnight in Lanzhou and take a morning train west, or accept the risk knowingly.

Seat classes on the two legs

The classes are the standard ones, described berth by berth on the seat and berth classes page. This is the short version for planning.

ClassWhere it appearsWhen it makes sense
Second class seatHigh-speed trains on both legsThe default. Cheapest seated option and the one that sells out first.
First class seatHigh-speed trains on both legsA whole day in a seat is a long time; the wider chair is worth it on leg one.
Hard sleeperConventional trains, both legsTurns travel hours into sleeping hours at the lowest price.
Soft sleeperConventional trains, both legsFour berths and a door. The comfortable way to do a night on the Shanghai leg.
Hard seatConventional trainsCheap, and unpleasant for a night. Skip it on a 14-hour stretch.

Booking sites also list sleeper berths on some Lanzhou to Dunhuang services, which is worth looking for if you are doing the second leg overnight — the berth layout of a Chinese sleeper carriage is set out in the overnight sleeper guide.

Booking it: two tickets, one window

  1. Work out the dates backwardsThe scarce leg is Lanzhou to Dunhuang, not Shanghai to Lanzhou. Pick the day you want to arrive in Dunhuang, then choose the Shanghai departure that fits in front of it.
  2. Open sales 15 days outChina Railway releases each train 15 days before its departure date and sells until about 30 minutes before it leaves. Both legs open on their own schedule, so the second one becomes bookable a day or two after the first.
  3. Book on 12306 with the passport nameThe official app and English site accept foreign passports after identity verification. The setup is on the 12306 English guide. Agents book on the same system for a fee, and cannot conjure seats.
  4. Take the passport to the stationNo paper ticket. It is scanned at the entrance, at the gate and sometimes on the platform. Old or damaged passport covers are a common reason a gate will not read — use a staffed lane.
  5. Read the change and refund rules before payingTwo tickets means two sets of deadlines. The refund and change page has the timing that applies.

What the second leg actually looks like

Lanzhou westwards, the line runs up the Hexi Corridor: Wuwei, Zhangye, Jiayuguan, then the turn on to the Dunhuang branch at Liugou. Farmland and poplar rows give way to gravel desert, with the Qilian Mountains on the southern side for most of the run. It is one of the better train windows in China, and on a daytime departure you get the whole thing in daylight.

Travel light. The carry-on limits on high-speed trains are 20 kg per adult and 130 cm per bag, and a large suitcase plus a change of trains is the combination that ruins a good day — the details are on the luggage rules page.

Arriving in Dunhuang

Dunhuang Station (敦煌站) is the only passenger station in the city and it handles the high-speed sets as well as conventional trains, so there is no second-station trap at this end. It sits about 4.5 km from the town centre, between the main highway and the railway, on the side of town that faces the road south towards the Mogao Grottoes.

Most travellers stay in the guesthouse and hotel strip in the centre, a short taxi ride from the station, and use Dunhuang as a base for the Mogao Grottoes, the Crescent Moon Lake and the Singing Sand Dunes. The station design is worth a look on the way out; it borrows from desert caravanserai architecture rather than the usual glass box.

Frequently asked questions

Is there a direct train from Shanghai to Dunhuang?

No. There is no direct passenger train from Shanghai to Dunhuang Station. The route is travelled in two legs, with the change at Lanzhou or further west at Jiayuguan. Route listings quote around 25 to 35 hours of total rail travel for the connection.

How long does the journey take?

Route listings put the whole trip at roughly 25 to 35 hours, which usually means one long day plus one night on board, or two nights if you take conventional sleepers on both legs. The second leg, Lanzhou to Dunhuang, is listed at about 8.5 to 14.5 hours depending on the train.

Which stations do I use in Shanghai?

High-speed services to the west leave from Shanghai Hongqiao Railway Station, and conventional Z, T and K sleepers generally leave Shanghai Railway Station. The ticket always names the departure station, and Shanghai's stations are a long way apart, so check before leaving for the station.

Which train classes are sold on this route?

Second class and first class seats on the high-speed legs, and soft sleeper, hard sleeper and hard seat on the conventional trains. Booking sites also list sleeper berths on some Lanzhou to Dunhuang services, so the class list on the 12306 app for your date is the one to trust.

How far in advance can I book?

China Railway opens sales 15 days before departure for each train, counting the departure date, and closes them about 30 minutes before departure. Book both legs as soon as the second one opens, because the Lanzhou to Dunhuang services are the scarce part of the route.

Should I book both legs as one ticket?

There is no through ticket for this route, so you hold two separate tickets even when you buy them in one session. They are treated as two journeys: if the first train runs late and you miss the second, the second ticket is not automatically protected. Leave a margin or sleep in Lanzhou.

Where is the Dunhuang station?

Dunhuang Station (敦煌站) is about 4.5 km from the town centre, between the main highway and the railway, facing the road south towards the Mogao Grottoes. It is the only passenger station in the city and it handles the high-speed sets as well as conventional trains.

Is the train better than flying from Shanghai?

The train is about a day and a night of travel; route listings quote 6 to 9 hours for flights, usually with a stopover. Flying buys time, the train buys the Hexi Corridor scenery and a night off the hotel bill. Both are reasonable, and on a short trip the flight is the honest answer.

Is there a sleeper on the Shanghai leg?

Yes. Conventional Z, T and K trains run overnight from Shanghai towards Lanzhou with soft sleeper, hard sleeper and hard seat. Taking one of those instead of a daytime high-speed train turns the first leg into a night rather than a day of your trip.

Related reading

Other long routes built on the same logic — a long day on the trunk, then a change — are the Shanghai to Hong Kong page, and the Beijing to Xi'an page, which covers the eastern half of the corridor run west towards Gansu.

Compiled from China Railway route listings for the Shanghai–Lanzhou–Dunhuang corridor, Lanzhou–Dunhuang service listings, Dunhuang branch and Dunhuang Station references, and 12306 booking rules, cross-checked 30 September 2026. There is no through service on this route, so journey times and fares are the sum of two tickets that are revised through the year — the 12306 app or the official channel for your travel date is the authoritative version. Nothing here is a booking guarantee.