The first railway in what was then Persia opened in 1888 between Tehran and the shrine of Shah-Abdol-Azim at Rey. The 9km line, built to 800mm gauge, was intended mainly for the use of pilgrims, although later a couple of quarry branches were added. Intially horse drawn, it was later converted to steam haulage. It continued in operation until 1952. The original route is now largely paralleled by line 1 of the Tehran metro.
There was a long hiatus in railway development until the construction in 1914 of a 146 km railway from Tabriz to Jolfa, on the border with present day Azerbaijan, then part of Russia. It was built to standard (1435 mm) gauge, as were subesquent railways in the country. However, by the outbreak of World War II, the total railway network amounted to little more than 700km.
Wartime construction of the Trans-Iranian Railway almost tripled this quantity and subsequent developments have led to a present day standard gauge network of over 10000km, with much more under construction or planned. There is an international connection with Turkey, and hence to the rest of Europe (albeit via a train ferry across Lake Van). In the Caucasus, there was an international connection involving a change of gauge with the Naxçivan enclave of Azerbaijan and beyond there to Armenia and Russia; however, this is currently out of use. A new international crossing with Azerbaijan opened in 2017, near the border town of Astara on the shore of the Caspian Sea; however, this location has yet to be linked by rail with the remainder of the Iranian network.
An international connection with Turkmenistan at Sarakhs, also involving a change of gauge, opened in 1996. This is envisaged as part of a potential through route to China. A further connection with Turkmenistan at Incheh Borun opened in 2013, part of a planned through route to Kazakhstan. There is also a short Russian (1520mm) gauge line from Turkmenistan serving the border facility at Loftabad, but this has no direct connection with the rest of the Iranian network.
A new line to Zahedan was completed in 2009. This provides interchange at Zahedan with the previously isolated 84km line to the Pakistan border. The latter line is connected with the Pakistan Railways network and is built to the 1675mm gauge of that system.
In 2013, a short (16km) but important line was opened between Khorramshahr (near Abadan) and Shalamcheh on the border with Iraq. This will eventually connect with the Iraqi rail network near Basra, although work remains to be done on the Iraqi side of the border.
In 2015, construction commenced on a new line between the capital Tehran and Khosravi near the border with Iraq. The line opened as far as Kermanshah in 2018. The remaining 263km to Khosravi is expected to be completed by 2020.
A line is under construction between Mashhad and Herat, Afghanistan. The Iranian section as far as the Afghan border near Khvaf is complete; work continues on the railway in Afghanistan and the cross-border connection commenced in 2016.
In 2017, a new international connection was opened between Astara and the city of the same name in Azerbaijan. It is a dual (1520mm and 1435mm) gauge railway and will eventually be linked with the remainder of the Iranian network by a new line currently under construction.