Ninh Binh is 90 km south of Hanoi and well connected. The Reunification Express train stops at Ninh Binh station — the journey from Hanoi takes around two hours and costs a few dollars. Trains run multiple times daily; book ahead on the Vietnamese Railways website or at the station.
Buses from Hanoi's Giap Bat station run frequently and take two to three hours depending on traffic. They drop you near the city centre.
Many travellers do Ninh Binh as a day trip from Hanoi, which works for Tam Coc or Trang An alone. Staying overnight lets you visit multiple sites and catch the morning light over the paddies, which is considerably better.