These two places are approximately 1225.3 kilometers apart.
According to information from Baidu Maps, Shanghai is located in the eastern part of China, at the mouth of the Yangtze River. It is situated in the northern part of the North China Plain and borders Tianjin to the east. The distance from Shanghai to Beijing is approximately 1225.3 kilometers. You can take the G28 train from Shanghai Hongqiao Station and get off at Beijing South Station to reach the city center of Beijing. The journey takes approximately 4 hours and 18 minutes.
If you choose to drive, the entire journey will take around 13 hours and 43 minutes. After exiting the Beijing-Taipei Expressway, drive for 5.4 kilometers and enter Dexian Road. Then, continue straight onto Liuxiang Road, and subsequently, stay in the left lane to enter Tiantan Road, Chongwenmen Outer Street, and finally turn left onto Chongwenmen West Street. Continue straight onto Qianmen East Street, drive 360 meters, make a right turn onto Qianmen East Street service road, drive 70 meters, and then make a right turn onto Zhengyi Road. Drive 390 meters to reach the city center of Beijing.