Rail transport in South Africa is an important element of the country's transport infrastructure. All major cities are connected by rail, and South Africa's railway system is the most highly developed in Africa. The South African rail industry is publicly owned.
The first track for steam-powered locomotives was a line of about 3.2 kilometres (2 mi) by the Natal Railway Company, linking the town of Durban with Harbour Point, opened on 26 June 1860. Cape Town had already started building a 72-kilometre (45 mi) line, track gauge 1,435 mm (4 ft 8 1⁄2 in), linking Cape Town to Wellington in 1859 but was hampered by delays and could only open the first section of the line to the Eerste River on 13 February 1862. However Cape railway construction began a massive expansion, after the formation in 1872 of the Cape Government Railways.
In the north, in the independent South African Republic, railway construction was done by the Netherlands-South African Railway Company (NZASM), which constructed two major lines: one from Pretoria to Lourenço Marques in Portuguese East Africa Colony, and a shorter line connecting Pretoria to Johannesburg. A national "link-up" was established in 1898, creating a national transport network. This national network was largely completed by 1910. Though railway lines were also being extended outside of South Africa, as far north as Northern Rhodesia (present-day Zambia), the vision of Cecil John Rhodes, to have a rail system that would run from the "Cape to Cairo", would never materialise.