Lamphun is located in the river valley of the Ping River, surrounded by mountain chains. It is some 670 kilometres from Bangkok and only 26 kilometres from Chiang Mai.
Under its old name of Haripunchai, Lamphun was the northernmost city of the Mon kingdom of the Dvaravati period, and also the last to fall to the Thai. In the late 12th century it came under siege from the Khmer, but did not fall. However in 1281 King Mengrai of Lanna finally seized the city, and made it part of his kingdom. After Burmese expansion in the sixteenth century, Lamphun was also under Burmese rule for two centuries. In the eighteenth century, with the rise of Thonburi and Bangkok against Burmese rule, local leaders from Lampang agreed to be their allies. Lamphun was finally free from the Burmese and ruled by relative of Lampang's leader, gaining vassal status from Bangkok. Eventually after the administrative reform of Bangkok government in late nineteenth century, Lamphun became a part, as a province, of Siam or late Kingdom of Thailand.