The railway network in New Zealand consists of four main lines, seven secondary lines and numerous short branch lines in almost every region. It links all major urban centres except Nelson, Taupo, Queenstown, Whakatane and (since 2012) Gisborne. The network is owned and managed by KiwiRail. The network was constructed from 1863 onwards, mostly by government bodies, initially provincial governments and later central government (usually the Public Works Department). In 1993 New Zealand Rail Limited was privatised (and later renamed Tranz Rail), with the New Zealand Railways Corporation retaining the land (due to Treaty of Waitangi claims on land taken for railway construction). In 2003 the government renationalised the network. KiwiRail operates all freight and most passenger services, including Metlink passenger trains in the Wellington region, operated by its Tranz Metro business unit; Transdev operates Auckland Transport 'AT Metro' suburban passenger trains in Auckland; Dunedin Railways (formerly Taieri Gorge Railway) operates tourist passenger trains in Dunedin.
Lines in bold type are currently operated by KiwiRail
The last two lines are sometimes referred to as the South Island Main Trunk Railway.
Parts of the network were constructed by private companies, and most were unsuccessful. All except the Whakatane Board Mills line and the Sanson Tramway were later acquired by the government. The most successful was the Wellington and Manawatu Railway, which operated between Wellington and Longburn (near Palmerston North) from 1885 to 1908. After the WMR, perhaps the best-known private railway was the New Zealand Midland Railway Company, which constructed parts of the Midland, Nelson and West Coast lines. After the company was dissolved in 1900 the railway lines and their construction were taken over by the government. Some lines were built by companies for access such as to coal mines, and by local government bodies.