Dear Rachit,
Thanks for contacting Top China Travel!
The air distance between Beijing and Shanghai is about 1084 kilometer for about 2 hours and 10 minutes ride, railway distance is about 1463 kilometer for about 22 hours of train, 10 hours of bullet train.
Any further request or question, please feel free to contact with us.