Dalkeith is a town in Midlothian, Scotland, on the River Esk. It was granted a burgh of barony in 1401 and a burgh of regality in 1540. The settlement of Dalkeith grew southwestwards from its 12th-century castle. Dalkeith has a population of 12,342 people according to the 2011 census.