The York and Doncaster branch was a railway line that opened in 1871 connecting Doncaster with York via Selby in Yorkshire, England. This line later became part of the East Coast Main Line (ECML) and was the route that express trains took between London King's Cross, the north of England and Scotland. It was opened by the North Eastern Railway (NER) between York and Shaftholme Junction, some 4.5 miles (7.2 km) north of Doncaster railway station. Between its opening in 1871 and the grouping in 1923, the line was used by both the NER, and the Great Northern Railway (GNR). All of the intermediate local stations that had opened with the line in 1871 closed down in the 1950s and 1960s leaving just Selby open between the town of Doncaster and the city of York.