The Keith and Dufftown Railway is an historic railway in Scotland that ran between Dufftown and Keith. The company was formed in 1857, the line was opened in 1862, and it was absorbed by the Great North of Scotland Railway in 1866.
The Great North of Scotland Railway (GNoSR) opened its main line in stages; the section between Huntly and Keith was opened on 10 October 1856. Keith remained the terminus for less than two years; on 18 August 1858, the Inverness and Aberdeen Junction Railway (I&AJR) opened the last section of their line, between Elgin and Keith, and it was now possible to travel between Aberdeen and Inverness by rail. The I&AJR had an end-on junction with the Inverness and Nairn Railway at Nairn, and these two companies amalgamated in 1861, soon amalgamating with others, to form the Highland Railway. Although the GNoSR owned shares to the value of £40,000 in the I&AJR, it did not become part of the Highland Railway, but were instead bought out; the GNoSR then remained independent of the I&AJR until their respective successors were nationalised in 1948.
The GNoSR wished to have its own route west of Keith, with Grantown-on-Spey as an objective - here they hoped to meet any possible line between Perth and Inverness. To this end, they invested in the Keith and Dufftown Railway (K&DR); this company was incorporated on 27 July 1857, but progress was slow because of lack of money. Powers for a longer, but cheaper, route between the two towns were secured on 25 May 1860, and this line was opened on 21 February 1862. The revised route included steeper gradients than those planned in 1857; the maximum gradient was now 1 in 60 (1.667%) instead if 1 in 70 (1.429%). There was a viaduct over the Fiddich of two spans, and there were three intermediate stations: Earlsmill (renamed Keith Town in 1897), Botriphnie (renamed Auchindachy in 1862) and Drummuir. From the start, the trains were worked by the GNoSR under an agreement dating back to the formation of the company.