In ancient times,
Yu the Great bored a tunnel in the nearby
Mount Longmen (Dragon Gate Mountain) to alleviate the frequent flooding that occurred in the area, which led to the area being called
Dragon Gate (). During the
Western Zhou dynasty, the area was bestowed on the
Han Marquises. During the
Spring and Autumn period, the area was under the administration of the
State of Jin and became known as
Hanyuan () or "Land of the Hans." In the
Warring States period, the area belonged to the
State of Wei and was called
Shaoliang (). Towards the end of the Warring States period, the
State of Qin conquered and designated the area as
Xiayang County (). In the
Sui dynasty, the area received its present name of Hancheng. In 1983, Hancheng County became Hancheng City. In 1986, the city was named a
National Historic and Cultural City () and, ==Administrative divisions==