Bonnyrigg is a small town in Midlothian, Scotland, located 6 miles (10 km) southeast of Edinburgh in the parishes of Cockpen and Lasswade. Bonnyrigg was a mining village until the 1920s and had a carpet factory that was demolished in 1994. The village centre mostly dates from the 19th Century though buildings at the main crossroads were built in the 1960s. In 1929 it united with Lasswade Village.
In nearby Polton are found buildings from the 18th and 19th centuries including De Quincey Cottage--home of the writer Thomas de Quincey (1840-59), Blairesk Hall (c.1818) and Midfield House (18th-century, reconstructed 1914).
The town had a population of 11,260 in the 1991 census which had risen to 14,457 by 2001. Details for 2011 are not yet available.