 The Edinburgh, Perth and Dundee Railway (successor to the Edinburgh and Northern Railway) was authorised to make a branch from Thornton (near present-day Glenrothes) to Dunfermline.Dunfermline was an ancient seat of government and industry, but it was the minerals, especially coal, in the area which encouraged the building of a line.The Edinburgh and Glasgow Railway too saw that potential, and promoted a nominally independent company, the Stirling and Dunfermline Railway, which would capture the Alloa coalfield and develop other mineral locations at Dunfermline and elsewhere on the line of route

The Edinburgh and Glasgow Railway sought to expand northwards and formed an alliance with the Scottish Central Railway, and submitted a Parliamentary Bill for the 1846 session for a "Stirling and Dunfermline Railway".