Datong is a prefecture-level city in northern Shanxi Province in the People's Republic of China. It is located in the Datong Basin at an elevation of 1,040 metres (3,410 ft) and borders Inner Mongolia to the north and west and Hebei to the east. As of the 2020 census, it had a population of 3,105,591 of whom 1,790,452 lived in the built-up (or metro) area made of the 2 out 4 urban districts of Pingcheng and Yungang as Yunzhou and Xinrong are not conurbated yet.
The area of present-day Datong was close to the state of Dai, which was conquered by the Zhao clan of Jin in 457 BC. It was a frontier land between the agricultural Chinese and the nomads of the Great Steppe. The area was well known for its trade in horses.