How long does the train from Xi'an to Shanghai take?
The fastest high-speed train takes about 5 hours 50 minutes. Most other high-speed trains take 7 to 9 hours. An overnight D or Z sleeper train takes about 15 to 17 hours, and the slower K trains 19 to 21. These numbers are from the 12306 English site search for Xi'an to Shanghai, made on 8 October 2026 for travel on 14 October 2026 (a Wednesday). The page showed 36 results. Fares change by date, so treat the prices below as a guide and search your own day.
The 36 results break down like this.
| Type | Trains | Leaves from | Journey time |
|---|---|---|---|
| G (high-speed) | 23 | Xi'an North, except G2193 from Gaoling | 5h50m to 9h1m |
| D (with sleeper berths) | 6 | Xi'an station | 14h57m to 15h50m |
| Z (overnight) | 4 | Xi'an station | 15h5m to 16h48m |
| K (slower, overnight) | 3 | Xi'an station | 19h5m to 21h5m |
Source: a 12306 English-site search made on 8 October 2026 for travel on 14 October 2026; fares change by date.
Xi'an to Shanghai high-speed train times
For travel on 14 October, the G trains are listed with departures between 06:13 (G1914) and 15:56 (G1942). The two fastest are G92, 08:51 to 14:43 (5h52m), and G96, 15:32 to 21:22 (5h50m). Both run from Xi'an North to Shanghai Hongqiao. Every other G train takes 7 hours or more: G1820 is the shortest at 7h, and G1980 the longest at 9h1m.
Two G trains do not follow the usual pattern. G2193 leaves from Gaoling (高陵) at 11:35. G3258 arrives at Shanghai South (Shanghainan, 上海南) at 19:02 instead of Hongqiao. If you want Hongqiao, check the arrival station on the result line before you pay.
Is there an overnight sleeper train from Xi'an to Shanghai?
Yes. For 14 October the result lists three kinds of overnight trains, all leaving from Xi'an station (the result calls it Xian, 西安). None of them leaves from Xi'an North.
- D trains with sleeper berths: D94 15:10 to 06:13 next day (15h3m), D128 19:25 to 10:22 next day (14h57m), D290 21:03 to 12:09 next day (15h6m), D124 21:16 to 12:30 next day (15h14m).
- Two D trains that leave just after midnight on 14 October: D114 at 00:33 and D218 at 00:53. You board them on the night of 13 October. D114 arrives 16:23 the same day (15h50m) and D218 arrives 15:50 (14h57m).
- Z trains: Z378 20:41 to 13:29 next day (16h48m), Z166 20:49 to 12:03 (15h14m), Z42 21:10 to 12:15 (15h5m), Z306 21:41 to 12:54 (15h13m). All four arrive at Shanghai.
- K trains: K362, K2188 and K558 are slower, at 19h5m to 21h5m, and also leave from Xi'an station.
D114 and D128 arrive at Shanghai Songjiang (上海松江), not at Shanghai Railway Station. This list is for 14 October only. The result says nothing about other dates.
How much is a Xi'an to Shanghai train ticket?
These are the fares 12306 listed for travel on 14 October 2026 in a search made on 8 October 2026. Every G fare carries an "x% off" label, from 6% to 30% off. A labelled fare is already discounted, so the full fare is higher, and fares change with the train and the date. The D, Z and K prices below carried no discount label.
- G second-class seat: ¥652 (G3298) to ¥783 (G3178), every fare with a discount label (7% to 22% off).
- G first-class seat: ¥1,039 (G3298) to ¥1,258.5 (G1980), every fare with a discount label (6% to 21% off).
- G business-class seat: ¥2,048 (G3298) to ¥2,642 (G96), every fare with a discount label (7% to 30% off).
- Sleeper D trains: second-class sleeper ¥369 to ¥400, first-class sleeper ¥531 to ¥596, and a second-class seat on the same trains ¥233 to ¥240.
- Z and K trains: hard sleeper ¥310.5, soft sleeper ¥488.5 and hard seat ¥180.5 on all seven. Z42 also sells a deluxe soft sleeper at ¥902.5.
Sleeper prices are upper berth
The result page says: "The sleeper ticket prices shown on the page are all for upper berth. The actual prices vary among different berths." The sleeper fares above are the upper-berth prices, so do not assume they are what you will pay for every berth.
Which station: Xi'an North or Xi'an station, Hongqiao or Shanghai Railway Station?
The departure station and the arrival station are both written on every result line. Read them before you pay, because Xi'an and Shanghai each have several stations.
In Xi'an, the result uses the names Xianbei (Xi'an North, 西安北), Xian (Xi'an station, 西安) and Gaoling (高陵). For which one you need and how to reach it by metro, see our Xi'an railway stations guide.
In Shanghai, the result uses four names. "Shanghai" is the result's name for Shanghai Railway Station (上海站). The Shanghai government guide lists the stations and their metro lines:
- Shanghai Hongqiao (虹桥): Shengui Road, Minhang district; metro lines 2, 10 and 17. All G trains on the result arrive here except G3258.
- Shanghai Railway Station (上海站): Moling Road, Jing'an district; metro lines 1, 3 and 4. The result shows it as Shanghai. Most D, Z and K trains arrive here.
- Shanghai South (Shanghainan, 上海南): Humin Road, Xuhui district; metro lines 1, 3 and 15.
- Shanghai Songjiang (上海松江): Songxian Road, Songjiang district; Line 9.
The Shanghai government guide says to confirm your arrival and departure station before travelling and to double-check the station name before heading to the station.
Metro from Hongqiao station and Shanghai Railway Station
Hongqiao railway station is on metro lines 2, 10 and 17. Shanghai Railway Station is on lines 1, 3 and 4. That is all the lines the Shanghai government guide gives for them. It has no fares, first or last train times, or transfer points. Use the Shanghai Metro map or app for those.
Hongqiao railway station is part of the Hongqiao transportation hub, which the Shanghai government describes as linking aviation, railways, long-distance coaches, suburban railways, urban rail, buses, ride-hailing services and taxis. Separately, the Shanghai airports page says Hongqiao airport Terminal 1 is served by Line 10 and Terminal 2 by lines 10 and 2. Neither page says how the station and the terminals connect, how far apart they are, or how long the walk is.
How to buy a Xi'an to Shanghai train ticket on 12306 with a foreign passport
12306 is the only official railway ticket site. The railway's own FAQ says the railway department will not handle ticketing problems that occur on other websites. The English version accepts only valid foreign passports.
- Register. On the 12306 English register page, fill in nationality, name, passport number, passport expiration date, date of birth, gender, username, password and email address. The page says only foreign passports are accepted for registration, and that notifications are sent by email. The form has no phone-number field.
- Verify your identity. A Ministry of Commerce guide posted on the Beijing government English site says foreign travelers must do this before buying. You fill in name, nationality and ID number on the English site or app and the system checks automatically. Or you upload a photo of the passport information page for manual verification. Or you take your passport to a station ticket office. Type your name in English in the order on the passport, with a space between surname and given name, and spaces inside either part where the passport has them.
- Wait for "verified". The railway's Chinese identity-verification notice says accounts marked 待核验 (waiting) or 未通过 (failed) cannot buy tickets until they are verified.
- Search and read the line. Enter From, To and Date. Check the departure station, the arrival station, the train number and the time. The search page also has a ‘High-speed trains only’ option.
- Pay. The Ministry of Commerce guide says that online you can pay by Chinese or foreign bank cards as well as mobile payment apps, and that for specific methods you should "refer to the signage or cashier for guidance". At a station ticket office you can pay by Chinese or foreign bank cards, in RMB cash, or by mobile payment apps.
If you buy for a companion, the FAQ says you can do so once their ID status is "verified" or "ready to be verified". The English site offers purchase, endorsement, refund and change of destination. It sells tickets from 5:00 to 1:00 the next day (5:00 to 23:30 on Tuesday); information queries and refunds run 24 hours. For fees on a refund or change, see 12306 refund and change fees.
Foreign passports are on the railway rules' list of documents for station ticket counters and for 12306, but not on the list for self-service machines. The machine list has the Foreign Permanent Resident ID Card instead. So with a passport, buy online or at a counter.
How many days ahead can I buy?
The 12306 help page gives internet presale as 15 days including the day of purchase, released at staggered times by region. It adds that railway bureaus may adjust the period temporarily. So the figure is currently 15 days; check the date bar on the 12306 search page for what is open now. The help page has no date on it.
Boarding with a passport: gates and the itinerary sheet
The ID you used to buy the ticket is your boarding document. The railway rules (in force from 1 June 2026) say the boarding document is the valid ID used to buy the ticket. The FAQ says to show it to enter and leave the station and to get aboard. Bring the same passport the ticket was bought with. The rules treat a ticket, ID and person that do not match as having no ticket.
After you buy, you can print or download an "itinerary sheet" on 12306. The FAQ says it cannot be used as a ticket, and the railway rules say the same. Keep it as a record, not as your pass.
The Ministry of Commerce guide says foreign travelers can enter and exit the station through "automatic or manual ticket check gates" with the original ID used to buy the ticket, and "cooperate to complete ticket verification on the way". Neither the Ministry of Commerce guide nor the 12306 FAQ says whether a passport can be scanned at an automatic gate, so leave extra time at the gate. The FAQ says ticket sales and checks stop before departure (the station announcement gives the time), and that there may be queues at the ticket window, security check, ID verification counter and ticket gate. All passengers and bags go through a security check. Arrive early.
Going on to sightseeing? See our Shanghai travel guide, and for the city you are leaving, the Xi'an travel guide. Coming from Beijing? There is a Beijing to Xi'an train guide too. We can book train tickets for you, and we can help plan the days around your train times.