Datong has direct high-speed rail connections to Beijing (about 2 hours on the G-train) and to other major cities in Shanxi, including Taiyuan. The city also has Yungang Airport (DAT) with domestic flights to Beijing, Shanghai, and other Chinese cities, though rail is generally faster and cheaper for Beijing.
From Beijing, the most convenient option is the high-speed train from Beijing North Station or Beijing West Station to Datong North Station, which is some distance from the city centre. A taxi or ride-share from the station into town takes 20 to 30 minutes.
The Yungang Grottoes are 15 kilometres from central Datong. City buses run there from the main bus station, but tourist shuttle buses are easier to find and operate from near the train station on peak-season days. Taxis and ride-shares are straightforward to arrange.