Located in Midlothian, 5 miles (8 km) southeast of Edinburgh and a half-mile (1 km) south of the A720 Edinburgh bypass, Loanhead is a former mining (coal and shale) and paper-making town which had a market from the late 17th Century. The Clerks of Penicuik built miners' houses in 1736 while in 1884 Loanhead was established as a burgh with several villas built in this period.
Today, the town benefits from a leisure centre, library, health centre, three primary schools (Loanhead, Paradykes and St. Margaret's Roman Catholic), three churches (Loanhead Parish Church, St. Margaret's Catholic Church and a Free Baptist Church) and busy local shops. Loanhead Children's Day and Gala Week, which takes place every June, represents the oldest and largest festival in Midlothian, founded in 1903. A music festival has been held in the same month since 2001.
Between 1874 and 1933, Loanhead had a station on the Edinburgh, Loanhead and Roslin Branch of the North British Railway. It is now served by Lothian Buses, with direct services into the centre of Edinburgh.
Ramsay Colliery, lying to the east of the village, was sunk c.1850 and latterly comprised two shafts of 174m (570 feet) and 302m (990 feet) respectively. At its peak it employed 385 men but it also closed in 1965. Burghlee Colliery to the southwest was sunk c.1860 and was 366m (1200 feet) in depth. This employed 795 miners at its peak but closed in 1965, to be redeveloped as the Bilston Glen Super Colliery, which survived until 1989 and is now the site of the Bilston Glen Industrial Estate, which includes MacSween's haggis factory and the communications centre for Police Scotland. Several other industrial parks have been developed around the town, but now a number of residents commute into Edinburgh. Immediately to the north is the Straiton retail park.
The naval, marine and mechanical engineers MacTaggart Scott were established in Loanhead in 1898 and invented the steam catapult for launching aircraft at sea. They have supplied components for every British Navy submarine, the drive machinery for Tower Bridge in London and the massive aircraft lifts for the Queen Elizabeth Class aircraft carriers, which entered service in 2017. The same MacTaggart family also produced two notable painters; William McTaggart (1835 - 1910) and Sir William MacTaggart (1903-81).
A half-mile (0.8 km) to the southeast of the village at Polton is one of Scotland's finest country houses, Mavisbank House (1723-7), built by William Adam for the laird and mine owner Sir John Clerk. Now ruined, it was once used as a hospital but was struck by fire in 1973.