Dunfermline (Scottish Gaelic: Dùn Phàrlain) is a large town in Fife, Scotland. It is located on high ground 5 miles (8.0 km) from the northern shore of the Firth of Forth on the route of major road and rail crossings across the firth to Edinburgh and the south. Dunfermline has a population of 45,462, making this the second-largest settlement in Fife. The town also falls under the wider Dunfermline and West-Fife Local Plan area which has an overall total population of around 100,324.
Dunfermline was a capital of Scotland, being an ancient seat of the kingdom's Royal Court and an important ecclesiastical centre. Its former abbey, now a parish church, is the burial place for many in the country's line of monarchs including Robert I and Saint Margaret. Ruins of the former abbey infrastructure today include the remains of the Royal Palace of Dunfermline, birthplace of Charles I, and are an important tourist attraction.
In modern times, the most famous son of Dunfermline was the wealthy industrialist, businessman, and philanthropist Andrew Carnegie. He was the central figure in promoting its early 20th century urban renewal and his financial legacy is still of major importance.
Traditional industries in Dunfermline's catchment area have principally involved textiles, engineering, defence and electronics. In more recent times this has begun to diversify into the service sectors, including tourism.