This article contains affiliate links. If you make a purchase through these links, we may earn a small commission at no extra cost to you. This helps support our work in creating free travel guides.
The classic Beijing–Xi'an–Shanghai route is three cities and two high-speed train rides, plus a third (Beijing–Shanghai) if you fly in and out of the same city. For a first trip, plan 3–4 nights in Beijing, 2 in Xi'an and 2–3 in Shanghai, and book an open-jaw flight: fly into Beijing and out of Shanghai, or the reverse. Beijing to Xi'an takes about four and a half hours on a typical fast train, and the fastest trains on a sample day did it in 4 h 10 min. Xi'an to Shanghai is the long leg: two fast trains took about 5 h 50 min, but most took 7–8.5 hours. This page goes leg by leg: which station you leave from, which one you arrive at, how many trains run, what a seat costs, and how to book and board with a foreign passport.
How many nights in each city, and which way round
Here is the split we suggest for a first visit, with the reasons:
- Beijing: 3–4 nights. The Forbidden City, the Great Wall and the Temple of Heaven each take most of a day, and the Great Wall is a trip out of the city. Three nights is tight; four lets you add the Summer Palace or a slow hutong (old lane) afternoon.
- Xi'an: 2 nights. One day for the Terracotta Army, which sits outside the city, and one day for the City Wall, the Muslim Quarter and the Big Wild Goose Pagoda.
- Shanghai: 2–3 nights. Two nights covers the Bund, the Pudong towers and Yu Garden. A third night gives you a water town or Suzhou as a day trip, or just a buffer before your flight home.
That is 7 to 9 nights. If you have exactly one week, our 7-day China itinerary shows what to cut. If you are still deciding how many cities to do at all, start with the first-time China itinerary hub.
North to south, or south to north
Let your international flights decide. Beijing and Shanghai are both big international gateways, and Xi'an sits between them on the rail map, so the route works the same in either direction. Book an open-jaw ticket (into one city, out of the other) so you never have to ride back the way you came. If your cheapest flight is a return to one city, you will need a third train at the end: Beijing to Shanghai, or the other way. That leg is covered further down.
Going north to south (Beijing first) has one small advantage: you get the most booking-heavy city done while you are fresh, and Shanghai is the easiest city to land in at the end of a tiring trip. Going south to north works just as well, and it gives you a little more time on the long leg: on the sample day the last direct train from Shanghai Hongqiao to Xi'an North left at 17:07, while the last one from Xi'an North to Hongqiao left at 15:56.
The table below shows all three legs side by side, from 12306 (the official China Railway booking system) data for one sample travel day (29 October 2026). Treat it as a guide to the pattern, not a timetable: train numbers and fares change with each schedule update, so check the exact train when you book.
| Route | Trains a day | Journey time | Sample fares: 2nd / 1st class |
|---|---|---|---|
| Beijing South → Shanghai Hongqiao Return: 38 trains, fastest 4 h 24 min (G12) | 37, all G departures 06:18–19:24 also 6 to Shanghai Station 50 trains a day between all Beijing and Shanghai stations, overnight and conventional trains included | fastest 4 h 18 min (G25) most 4 h 37 min – 6 h 08 min | ¥553–661 / ¥929–1058 business class ¥1744–2315 |
| Beijing West → Xi'an North Return: 17 trains, fastest 4 h 10 min (G324) | 17, all G departures 07:00–19:00 also 3 from Beijing Fengtai, 1 from Beijing North, 3 from Qinghe | fastest 4 h 10 min (G351) most 4 h 12 min – 5 h 50 min | ¥494–587 / ¥790–939 |
| Xi'an North → Shanghai Hongqiao Return: 21 trains, fastest 5 h 39 min (G94) Xi'an Station → Shanghai Station: 11 slower D/K/Z or overnight trains, fastest 14 h 57 min (D218) | 20, all G departures 06:13–15:56 also 1 to Shanghai South | fastest 5 h 50 min (G96) most 7 h 10 min – 8 h 26 min | ¥666–766.5 / ¥1062–1231.5 |
Leg 1: Beijing West to Xi'an North
Trains to Xi'an leave from Beijing West Station (北京西, Běijīng Xī), not Beijing South. Beijing West is on Metro Lines 7 and 9. You arrive at Xi'an North Station (西安北, Xī'ān Běi), the big high-speed station north of the city.
A quick guide to train numbers: G trains are the fastest high-speed trains; D trains are slightly slower bullet trains, and some D trains run overnight with sleeper berths; K, Z and T trains are older, slower conventional trains.
How many trains, how long
On the sample day (29 October 2026), 17 high-speed G trains ran from Beijing West to Xi'an North, the first at 07:00 and the last at 19:00. The fastest, G351 and G365, took 4 h 10 min, and the middle half of all trains took between 4 h 12 min and 5 h 50 min. So most trains get you there in well under five hours, and a few slower ones with more stops take closer to six.
A handful of trains also run from other Beijing stations, such as Beijing Fengtai, but Beijing Station itself had only one slow K train to Xi'an. For a daytime trip, search Beijing West to Xi'an North and pick from that list.
What a seat costs
Sample fares on the same day were ¥494–587 in second class and ¥790–939 in first class. The four-hour express trains cost the most in second class, ¥587, while the trains that take about 5 h 50 min cost ¥494–525. The difference is small, so in most cases take the fastest train that fits your morning. Second class is fine for four hours; if you are unsure what you get for the extra money in first, see China train seat classes explained.

The overnight option
You can also do this leg overnight and save a hotel night. On the sample day, D39 left Beijing West at 18:30 and reached Xi'an at 06:24 the next morning, and the older Z179 left at 18:20 and arrived at 06:51. These overnight trains take about 8.5 to 12.5 hours. Sample sleeper fares were ¥300 for a second-class sleeper berth and ¥458 for a first-class sleeper on D39, and ¥254.5 for a hard sleeper and ¥398.5 for a soft sleeper on Z179.
Two details catch people out. First, most of these night trains arrive at Xi'an Station (西安站, Xī'ān Zhàn, the old main station just north of the City Wall), not Xi'an North. That is actually handy, because you arrive close to the old town. Second, the D965 from Beijing Fengtai does go to Xi'an North, but it leaves at 20:36 and arrives at 05:08, which is a very early start to your day.
Our view: the day train is only about four hours, so it does not cost you much sightseeing time. Take the night train if you like the idea of a sleeper, or if you want to save the hotel night. Do not take it if you sleep badly on moving trains, because you will arrive tired for the Terracotta Army.
| Train | From → to | Departs → arrives | Duration | Sample sleeper fares |
|---|---|---|---|---|
| D17 | Beijing Station → Shanghai Songjiang | 19:10 → 07:31 next day | 12 h 21 min | – |
| Z281 | Beijing Fengtai → Shanghai Songjiang | 19:10 → 08:44 next day | 13 h 34 min | – |
| D7 | Beijing Station → Shanghai Station | 19:18 → 07:25 next day | 12 h 07 min | 2nd-class sleeper ¥440 · 1st-class sleeper ¥601 |
| D9 | Beijing South → Shanghai South | 19:36 → 08:00 next day | 12 h 24 min | 2nd-class sleeper ¥510 · 1st-class sleeper ¥646 |
| T109 | Beijing Station → Shanghai Station | 20:04 → 11:02 next day | 14 h 58 min | – |
| D5 | Beijing Station → Shanghai Station | 21:21 → 09:27 next day | 12 h 06 min | 2nd-class sleeper ¥474 · 1st-class sleeper ¥644 |
| Train | From → to | Departs → arrives | Duration | Sample sleeper fares |
|---|---|---|---|---|
| D18 | Shanghai Songjiang → Beijing Station | 18:42 → 07:09 next day | 12 h 27 min | – |
| D8 | Shanghai Station → Beijing Station | 19:08 → 07:17 next day | 12 h 09 min | – |
| Z282 | Shanghai Songjiang → Beijing Fengtai | 19:17 → 09:52 next day | 14 h 35 min | – |
| D10 | Shanghai South → Beijing South | 21:05 → 09:24 next day | 12 h 19 min | – |
| D12 | Shanghai Songjiang → Beijing Fengtai | 21:14 → 09:24 next day | 12 h 10 min | – |
| D6 | Shanghai Station → Beijing Station | 21:15 → 09:25 next day | 12 h 10 min | – |
| Train | From → to | Departs → arrives | Duration | Sample sleeper fares |
|---|---|---|---|---|
| D15 | Beijing West → Xi'an East | 17:00 → 05:11 next day | 12 h 11 min | – |
| Z179 | Beijing West → Xi'an Station | 18:20 → 06:51 next day | 12 h 31 min | hard sleeper ¥254.5 · soft sleeper ¥398.5 |
| D39 | Beijing West → Xi'an Station | 18:30 → 06:24 next day | 11 h 54 min | 2nd-class sleeper ¥300 · 1st-class sleeper ¥458 |
| D41 | Beijing West → Xi'an Station | 20:03 → 08:46 next day | 12 h 43 min | – |
| D43 | Beijing West → Xi'an Station | 20:29 → 08:23 next day | 11 h 54 min | – |
| D965 | Beijing Fengtai → Xi'an North | 20:36 → 05:08 next day | 8 h 32 min | sleeper berth ¥510 |
| D967 | Beijing Fengtai → Xi'an North | 20:41 → 05:14 next day | 8 h 33 min | – |
| Train | From → to | Departs → arrives | Duration | Sample sleeper fares |
|---|---|---|---|---|
| D40 | Xi'an Station → Beijing West | 17:31 → 06:00 next day | 12 h 29 min | – |
| D42 | Xi'an Station → Beijing West | 20:23 → 08:49 next day | 12 h 26 min | – |
| T56 | Xi'an Station → Beijing Fengtai | 20:30 → 10:23 next day | 13 h 53 min | – |
| D44 | Xi'an Station → Beijing West | 20:35 → 08:23 next day | 11 h 48 min | – |
| D118 | Xi'an East → Beijing Fengtai | 21:53 → 10:44 next day | 12 h 51 min | – |
| D16 | Xi'an East → Beijing West | 23:34 → 12:16 next day | 12 h 42 min | – |
Getting into Xi'an from Xi'an North
Xi'an North is served by Metro Lines 2, 4 and 14. Line 2 runs straight to the Bell Tower in the old city center with no change, and Line 4 goes to the Big Wild Goose Pagoda area. If your hotel is inside or near the City Wall, Line 2 is the one. Allow extra time on arrival day, because the station is large and the ride into the center is not short; check the journey time in a map app before you set off.
Leg 2: Xi'an North to Shanghai Hongqiao
This is the longest leg, and the one where you should look hard at the train times before you book. You leave from Xi'an North and arrive at Shanghai Hongqiao (上海虹桥, Shànghǎi Hóngqiáo), the main high-speed station on the west side of Shanghai.
How many trains, how long
On the sample day there were 20 G trains from Xi'an North to Shanghai Hongqiao, the first at 06:13 and the last at 15:56. The two fastest, G96 and G92, took about 5 h 50 min, but most trains took 7 h 10 min to 8 h 26 min. In plain terms: the fast trains are a half-day ride, the rest take most of the day, and nothing direct leaves Xi'an North in the evening.
The trains from Xi'an's old main station to Shanghai Station are slow D, K and Z trains or overnight trains; the fastest of those took almost 15 hours on the sample day. Skip them unless you want a sleeper experience.
What a seat costs
Sample fares were ¥666–766.5 in second class and ¥1,062–1,231.5 in first class. The fast G96 and G92 cost ¥756 in second class. On a ride this long, first class is worth considering if your budget allows: wider seats and more legroom matter more over seven hours than over four.

Train or plane?
This is the one leg where flying is a real option. Our rule of thumb:
- Take the train if you can get one of the two fast trains (about 5 h 50 min). Once you add getting to the airport, security and the ride in from a Shanghai airport, a flight rarely saves much time over that, and the train takes you from city to city with no check-in.
- Consider flying if the fast trains are sold out and only the 7–8.5 hour trains are left, or if you want to leave Xi'an in the evening after a full day of sightseeing, since the last direct train leaves in mid-afternoon.
Flight times and fares change a lot by season and airline, so compare both on the day you book. Our domestic flights guide covers booking, baggage and security if you go that way.
Getting into Shanghai from Hongqiao
Hongqiao Railway Station has its own metro stop on Lines 2, 10 and 17, reachable from south exits 1–3 and north exits 1–3. From south exit 1 or north exit 1 you can also walk about 200 m east to the Hongqiao Airport Terminal 2 metro stop for Lines 2 and 10. Line 2 runs east to People's Square and East Nanjing Road, which is the easiest way to reach hotels near the Bund. The ride across the city is long, so check the time in a map app before you plan an arrival-evening dinner.
Going the other way, or doing only Beijing and Shanghai
Going south to north, the same trains run in reverse. On the sample day, 21 trains ran from Shanghai Hongqiao to Xi'an North, with the fastest, G94, taking 5 h 39 min. From Xi'an North back to Beijing West there were 17 G trains, the fastest, G324, taking 4 h 10 min.
If you fly in and out of the same city, or skip Xi'an, you need the Beijing–Shanghai train. This is the busiest line on the route. Trains leave from Beijing South (北京南, Běijīng Nán), which is on Metro Lines 4 and 14, and arrive at Shanghai Hongqiao.
- Trains: 37 G trains on the sample day, from 06:18 to 19:24.
- Time: the fastest, G25, took 4 h 18 min, and the middle half of trains took 4 h 37 min to 6 h 08 min.
- Return: 38 G trains from Shanghai Hongqiao to Beijing South, the fastest, G12, taking 4 h 24 min.
- Fares: ¥553–661 in second class and ¥929–1,058 in first class on the sample day.
The Beijing–Shanghai high-speed line has used floating fares since 23 December 2020: the published fare is a ceiling, and the actual price goes up and down by season, time of day, seat class and section. On the sample day the fastest trains with few stops cost ¥661 in second class, and slower trains with more stops cost ¥553. In practice, the fast trains cost a little more and save you over an hour, which is usually worth it.
There are overnight sleepers on this line too. D7 left Beijing Station at 19:18 and reached Shanghai Station at 07:25, and D5 left at 21:21 and arrived at 09:27. Sample fares on D7 and D5 were ¥440–474 for a second-class sleeper berth and ¥601–644 for a first-class sleeper. Note the stations: these leave from Beijing Station, not Beijing South, and arrive at Shanghai Station, not Hongqiao. The overnight-train table in the Beijing–Xi'an section above covers both lines.
Booking the three tickets and getting on the train
Train tickets in China are tied to your ID. You buy with the traveler's passport details, and staff check that the ticket, the person and the passport match when you go in. There is no paper ticket to keep track of: your passport is what you show.
Where to book
The official way is 12306, China Railway's own website and app, which accepts foreign passports. The 12306 English site accepts only valid foreign passports. Before you can buy online, your identity check has to show "passed": you can upload a photo of your passport in 12306, or have it checked in person at a station ticket window. When you enter your name, type it in the same order as on your passport, keep any spaces inside your names, and put a space between surname and given name.
If 12306 gives you trouble, an English-language booking site is the simpler route. Trip.com sells China rail tickets in English with passport details, and the ticket ends up linked to your passport in the same way. Our step-by-step guide to booking train tickets compares the two.
When to book
Tickets go on sale 15 days before the travel date, counting the travel day itself. There is no single national release time; each station publishes its own sale start times. Book all three legs as soon as they open if you are traveling on a weekend, a Chinese public holiday, or around Golden Week in early October. The fast trains on the Xi'an–Shanghai leg are the ones most worth grabbing early, because there were only two of them on the sample day.
If plans change: refunds are free 8 days or more before departure, then cost 5%, 10% or 20% of the fare as departure gets closer. You can change a ticket only once. Full details are in our complete guide to China's high-speed trains.
At the station
- Use the staffed gate. Passengers with foreign passports go through the manual lane for the ID check and ticket check, both entering and leaving, because the automatic gates cannot read passports.
- Expect a security check. Every passenger and every bag goes through screening at the entrance.
- Watch your luggage size. The free allowance is 20 kg per adult, and on high-speed trains each piece should measure no more than 130 cm when you add length, width and height together. Carry-on and medium suitcases fit within that, but a large check-in suitcase can go over 130 cm, so measure yours before you leave home; see luggage rules in China for the details.
- Arrive early. Beijing West, Beijing South, Xi'an North and Shanghai Hongqiao are all huge, and the manual lane can have a queue. Give yourself a generous margin, and check the boarding and gate-closing times shown with your booking or on the station screens, because the gate closes before the train leaves.
For a walk-through of signs, waiting halls and platforms, read how to navigate a Chinese train station.

What to see in each city
Each city has its own full guide and day-by-day plan. Here is the short version, with the bookings that need doing before you arrive.
Beijing
The three big sights are the Forbidden City (故宫, Gùgōng), the Great Wall and the Temple of Heaven (天坛, Tiāntán). The Forbidden City is the one that needs planning: it takes real-name reservations only, sells no same-day tickets, opens bookings 7 days ahead at 20:00, and closes on Mondays except public holidays. Foreign visitors can book with a passport on the museum's international ticketing platform, which accepts international credit cards, and enter through the Meridian Gate (the south gate) with the same passport. Badaling Great Wall needs no separate reservation, and you can buy tickets at the site. Temple of Heaven tickets can be bought 1–7 days ahead through the park's official WeChat account with a passport, or at the park's ticket windows on the day. Our 3-day Beijing itinerary puts these into a day-by-day plan, and the Beijing travel guide covers the rest.
Where to stay: Dongcheng district, around Wangfujing or the hutongs east of the Forbidden City, keeps you close to the main sights and the metro. You can compare hotels there on Booking.com.
Xi'an
The Terracotta Army (兵马俑, Bīngmǎyǒng) is the reason most people stop here. Tickets are real-name and booked online through the museum's official website or its official WeChat accounts, and foreign visitors book with passport details and show the original passport at the gate. Entry is timed, and the museum asks you to be there half an hour before your slot. For your second day, walk or cycle the City Wall: the South Gate (Yongning Gate) entrances open 8:00–22:00, so a sunset or evening walk works well. Stay inside or just outside the wall, near the Bell Tower, so you are on Line 2 from Xi'an North. Our 2-day Xi'an itinerary and Xi'an travel guide have the full plan.
Shanghai
Start with the Bund (外滩, Wàitān), the riverside row of historic buildings facing the Pudong skyline. It is open all day, free, and close to East Nanjing Road station on Lines 2 and 10. Yu Garden (豫园, Yùyuán), a classical walled garden in the old town, is open 9:00–16:30 with last entry at 16:00, and closes on Mondays except public holidays. Go in the morning; the shopping streets around it stay open later. For three days in order, see our 3-day Shanghai itinerary and the Shanghai travel guide.
For getting around once you arrive, the WaysChina app works offline: it plans metro routes between sights in all three cities and lays out each day's stops as a simple itinerary.
💡 Tip: Check whether you can enter China visa-free before you book anything. Our guides on whether you need a visa for China and China's visa-free entry rules explain who qualifies and for how long.
FAQ
How long is the high-speed train from Beijing to Xi'an?
Most trains take between about 4 h 10 min and 5 h 50 min from Beijing West to Xi'an North, and the fastest on a sample day took 4 h 10 min. Pick a train that leaves from Beijing West and arrives at Xi'an North; that is where almost all the fast trains run.
Should I take the train or fly from Xi'an to Shanghai?
Take the train if you can get one of the fast ones, which took about 5 h 50 min on a sample day; most others took 7 to 8.5 hours. If only the slow trains are left, or you want to leave Xi'an in the evening, a flight makes sense. Compare flight times on the day you book.
How many days do I need for Beijing, Xi'an and Shanghai?
Plan 8 to 10 days: 3–4 nights in Beijing, 2 in Xi'an and 2–3 in Shanghai, plus your arrival and departure days. If you only have a week, the 7-day version shows what to cut.
How far ahead should I buy high-speed train tickets?
Tickets go on sale 15 days before departure, including the travel day. For weekends, public holidays and the fast Xi'an–Shanghai trains, book on the first day of sale. On ordinary weekdays you can usually still find seats a few days before.
To sum up: book an open-jaw flight into Beijing and out of Shanghai (or the reverse), plan 3–4 nights, then 2, then 2–3. Take the train from Beijing West to Xi'an North, and one of the two fast trains (G96 or G92 on the sample day) from Xi'an North to Shanghai Hongqiao. Set up your 12306 or booking-site account with your exact passport name before you fly, book each leg when sales open 15 days ahead, and book the Forbidden City and Terracotta Army tickets as soon as their windows open too. Then you only need your passport on each travel day.
Last updated: October 2026
Fact-checked sources
- Official China Railway 12306 23 pages
- Official Beijing Municipal Government 8 pages
- sohu.com
- Official The Paper (thepaper.cn)
- Official CNINFO (listed-company disclosures)
- ahwang.cn
- Official Chinese central government (gov.cn)
- Official dpm.org.cn
Show 8 more sources
- Official intl.dpm.org.cn 2 pages
- Official young.dpm.org.cn
- Official bookingticket.dpm.org.cn
- Bendibao (local listings site) 3 pages
- Official s.visitbeijing.com.cn
- Official bmy.com.cn 2 pages
- Official Meet in Shanghai (Shanghai Culture and Tourism Bureau) 3 pages
- Official Yu Garden (official site)
Last verified: 2026-10-29
Last train times for 10 Chinese metro systems
Every line and station, checked by hand — the same data behind our offline route planner.
Get the WaysChina App
Offline guides, currency converter, essential phrases, and more — all in your pocket.
Related Articles
7-Day China Itinerary: Three Ways to Spend One Week in China
One week in China: Beijing, Xi'an and Shanghai, Beijing and Shanghai at an easier pace, or Shanghai with Suzhou and...
Shanxi Itinerary: Datong, Mount Wutai and Pingyao by Train in 5–7 Days
Shanxi in 5–7 days: Beijing to Datong, Mount Wutai, Taiyuan and Pingyao, then Xi'an. Every train leg, the bus up...
10-Day China Itinerary: Beijing, Xi'an and Shanghai plus Chengdu or Guilin
Ten days in China: the Beijing, Xi'an and Shanghai triangle plus Chengdu or Guilin and Yangshuo, with two day-by-day...
Best Museums in China: Which to Visit and How to Book with a Passport
Most museums in China are free but many need a passport booking. Which museums to visit, when tickets open, which...