The network of railways in Northallerton, North Yorkshire, England, was constructed by three companies whose lines through the town were built between 1841 and 1852. They were all amalgamated into the North Eastern Railway (NER) which in turn was subsumed into the London and North Eastern Railway in 1923 and British Rail in 1948. British Rail closed two lines, the Wensleydale line in 1954 and a section of the Leeds Northern Railway to in 1969. The Wensleydale line was retained as a freight branch and resurrected as a heritage railway in 2003 but the line to Harrogate closed completely. Despite closures and rationalisation, the station still is at a major junction on the East Coast Main Line.

is on the East Coast Main Line and TransPennine Express Northern Line. The station is north of London King's Cross, north of railway station and south of railway station.

History 1841–1901 A railway between York and Darlington via Northallerton was suggested in 1826 in the York Herald, but the first railway, built by the Great North of England Railway (GNE), following the proposed route, only opened to mineral traffic in January 1841 and to passengers in March of the same year. When navvies were digging in the Castle Hills area of Northallerton, three Roman sarcophagi were unearthed which were taken to Darlington. station opened in March 1841, and the "York Herald" described it as "in the Elizabethan Gothic style". Although much remodelled, the station is in the same location, with staggered platforms as when first built. Opening beyond to did not come until 1844. In 1842, the GNE was absorbed into the Newcastle and Darlington Junction Railway (N&DJR), who, in 1846 gained Parliamentary approval for a line between Northallerton and Bedale. Work started the same year, but because of the unscrupulous practices of George Hudson, who controlled the N&DJR, work was halted in early 1848 The line opened between Northallerton and Bedale in March 1848. Various other schemes progressed the line through Wensleydale and the N&DJR became part of the York, Newcastle and Berwick Railway (YN&BR). The Wensleydale line left Northallerton westwards and had two connections with the mainline north of Northallerton; one at Castle Hills South and the other at Castle Hills North. Initially, access was from the north (the Darlington direction) which meant that trains originating in Northallerton had to reverse. This was remedied in 1882 with the opening of a direct curve onto the Wensleydale line.

The third line was the Leeds Northern Railway (LNR), previously the Leeds & Thirsk Railway, whose line opened in June 1852. The LNR line paralleled the YN&BR line at a lower level to the west. The GNE formation was built on an embankment that took it from what became Cordio Junction to Castle Hills on an embankment made from of earth from when Castle Hills, north of the station, was levelled. This was the second most difficult engineering task undertaken by the company between York and Darlington after the stone viaduct at Croft. The LNR station, Northallerton Town was in the North Bridge area. The LNR passed under the YN&B just north of Northallerton station where a short tunnel was driven under the YN&B line at an angle of 23%. Tunnelling took place while keeping the upper line open.Some writers refer to the tunnel as a "long bridge". The Eastern Trackmaps diagrams refers to the formation as a tunnel. No work took place until designs the tunnel were submitted by the LNR engineer, Joshua T Naylor, to the YN&B. The tunnel was constructed by driving piles into the GNE embankment and inserting a platform above them to support the rails. The tunnel was excavated and the space bricked up until the arches at either end could be completed. The tunnel is wide and long.

A spur at the north end of the station allowed trains to and from to call at the station and access the line towards and Stockton in 1856. This route was taken via the Thirsk line from Melmerby and then north along what became the ECML. It along with the YN&B and the LNR, became part of the North Eastern Railway in 1854,Initially, the North Eastern Railway was created by the YN&B, the LNR and the York and North Midland Railway, with the Malton & Driffield Railway being amalgamated quite soon afterwards. precipitated the closure of Northallerton Town station (LNR) although it remained open for well over a century as a goods depot. The line to Wensleydale was absorbed into the NER in 1858.

The LNR opened two platforms on its line adjacent to Northallerton station. They remained in use after mainline trains had been diverted through the station and via Thirsk. The low platforms were the terminus for local trains from Melmerby (via until 1901, when the line from Melmerby was doubled and became the key line north,Doubling began in March 1899 and took two years. and the line from Thirsk to Melmerby became secondary. When mainline trains were re-routed via the Melmerby to Northallerton line, the NER installed a junction at Cordio Wood to feed a spur into the south of the station. The low platforms became redundant and were abandoned but were resurrected during the Second World War and for engineering diversions. Access to the low platforms was via a path from the upper platforms. A door in the subway under the main running lines allowed passengers to interconnect between all platforms.

Other lines were planned, some gained Parliamentary approval. One was the York & Carlisle Railway which proposed a line from Northallerton and Bishop Auckland meeting near Barnard Castle and crossing the Pennines. The plan was abandoned in 1846 when the company merged with another.

1901–1948 In 1911, the station was remodelled when an improved connection was installed on the western side for access to the Wensleydale line. The down platform (Darlington-bound) was converted into an island platform with two running lines and a north-facing bay for Wensleydale services. Another bay was installed on the up platform (York-bound) which allowed services to depart south for the Ripon line, although the stopping service until 1901 had used the low platforms.

Starting in 1897, the tracks were "widened" in several sections between York and Northallerton. In 1931, the London and North Eastern Railway quadrupled most of the line and created the grade separated Longlands Junction south of Northallerton by 1933. It connected to the original formation from Ripon and allowed freight to avoid the station from the York direction. Trains heading south accessed the line south via the Longlands Tunnel () under the fast lines through the station. In 1942, the LNER installed up and down slow lines between and as wartime necessities led to an upsurge in traffic. British Rail completed the quadrupling of the line in 1959 and 1960.

In 1941, concerns about wartime bombing prompted building a chord from north of Romanby Road level crossing to Castle Hills Junction to connect the lower and upper lines and opened in November 1941. Should Northallerton station be bombed, it provided an alternative route. The new section was engineered with a unique feature; because of the gradient it was too low to bridge the Wensleydale line and too high to dive under the railway. Engineers created two moveable sections on rail wheels which when pushed together, created a bridge allowing trains bound to and from Wensleydale to traverse the section. If the wartime chord needed to be used, the moveable sections could be moved onto sidings on either side of the running lines. The bridge was constructed from two girders that straddled the lower running lines. The bridge completed the track circuits and prevented trains from running under when the bridge was in place, or from running over it if the lower wartime lines were in use. Trains could still access the Wensleydale line by reversing at Castle Hills Junction. Apart from testing, there is no evidence that the chord was used as Northallerton was rarely attacked (some bombs did land on one of the livestock marts). Closure of this section came in 1946.

1948 – present day When the passenger service ended on the Wensleydale line in April 1954 (due to its £14,000 per year loss-making revenue according to British Rail), the direct curve from the station onto the line was used less until it closed in 1970. Thereafter, freight services used Castle Hills siding and reversed into the loop to run-round. Some freight trains traversed the line with locomotives at both ends, a procedure known as top and tail, which removed the necessity to reverse and run-round. Services on the line comprised various loads, but up until December 1992, it conveyed limestone from Redmire to the British Steel complex at Redcar. The operation involved the train arriving from Teesside into the station via the Eaglescliffe line and reversing into the Castle Hills siding and continuing up the branch. On returning, the train reversed the process to access the Eaglescliffe line. In 1996, the Ministry of Defence paid £750,000 to upgrade the line to convey military vehicles in and out of Catterick Camp.

The last section of line to be closed, the Leeds Northern Line from and , closed to passengers in 1967 but was not closed completely until 1969. The widened lines on the ECML, which provided four tracks between Northallerton and York, were an easier route south than some steeply graded sections around Ripon and Wetherby. The former LNR route was re-opened for services in the aftermath of the Thirsk rail crash. Some questioned the validity of closing the line citing the crash at Thirsk as reason to keep it open as an alternative line when the ECML would be closed. Various reports have detailed re-opening the line but some historical studies have suggested that the route should only open between Ripon south to Harrogate as there would be no business case to provide for a railway running further north. In 2015, North Yorkshire County Council submitted plans for transport schemes in North Yorkshire, the provision of a railway connecting Harrogate and Ripon to the ECML was among them. However, while the routeing of the railway north suggests that the freight railway through Northallerton could be closed, the plan calls for the junction of a re-opened line to be north of Northallerton town.

With the loss of the local and long-distance traffic on the Wensleydale and Harrogate lines, the bay platforms at the southern and northern ends of the station were taken out of commission. In 1982, British Rail announced its intention to revamp the dilapidated station, but with no funding from local authorities, the option to retain the Victorian buildings were limited. The down side buildings were removed in 1972–1973 and the up side lost its glass canopies in 1985. The station was remodelled between 1985 and 1986 with the down line on the western edge of the station (the down relief line) also being removed.

Local passenger services were lost on the Northallerton–Eaglescliffe route and most other passenger workings were transferred leaving freight using the line. British Rail started a named train to Midldlesbrough, the Cleveland Executive, but it ceased just before the ECML was electrified because of poor patronage north of Northallerton station. The route regained passenger services in the 1990s when Regional Railways introduced the Middlesbrough–Manchester Airport services which used the line rather than having to reverse at Darlington.