The history of rail transport in Norway had begun by 1805.
Norway's first railway is believed to have been the 14000NaN0 long horse-powered Damtjern-Storflåtan railway on Krokskogen, which was part of a longer route for timber transport from Land and Valdres to Oslo. The line was opened in 1805 and probably closed in 1849.
The next line was probably the one built on Blaafarveværket in the 1820s, by the German miner Karl Friedrich Böbert. This was a mine railway with its rails laid on cast iron sleepers. It was operated by horses and used to transport ore.
About the same time, the 12000NaN0 long Gjøsbubanen was built on Otteidanlegget in Mark Østfold. This was a combined canal and railway construction that made possible the transport of timber between the Store Le and Øymarksjøen lakes. Initially, the wagons were drawn up by a device operated by horses or oxen. From 1854, power was supplied by a stationary steam engine. The track was in use from 1825 to 1926.
Mortsjølungen-Tvillingtjern-banen (also known as the Grasmo Line) was a similar short line for the transport of timber between two rivers, namely the Mangenvassdraget and the Haldenvassdraget. The line was opened in 1849 and was in operation until 1931. At first, the wagons on this line were pulled by horses. From 1918, a motorized pulley was used. The line was about 14000NaN0 long.
The first public railway in Norway was the Norsk Hoved-jernbane (also known as the Trunk Line). Work on this line was led by the Englishman Robert Stephenson, son of George Stephenson, who had constructed the first public railway in the world.
The Trunk Line ran from Oslo to Eidsvold. Its main purpose was to transport lumber from Mjøsa to the capital, but also passenger services were operated. Construction of the line started in 1851 and it was opened on 1 September 1854.
Finance for the Trunk Line was raised by issuing 2.2 million shares for Norwegian speciedaler. Half the capital was provided by British shareholders and the other half by Norwegian interests, of which the State accounted for just over half.
The Trunk Line was until 1926 a corporation in which over the years the State acquired more and more of the shares. It was therefore formally a private company, and did not become part of the Norwegian State Railways (Norwegian: Norges Statsbaner) until 4 March 1926.
The section between Kristiania East and Lillestrøm was rebuilt as a double track line in 1902, and the line as a whole was electrified in two portions, in 1927 and 1953. The Trunk Line was the main line between Oslo and Eidsvoll until 8 October 1998, when the more direct, double-tracked high-speed Gardermoen Line opened, taking away most of the passenger traffic.
After the opening of the Trunk Line, there was interest in the development of public railways in several places in Norway.
Initially, Norwegian public railways were proposed as one of a number of steps in a longer transport route, combined with transport by sea. For example, the Trunk Line connected Oslo with steamboats on Lake Mjøsa, allowing steam powered transport to places like Lillehammer, 180 km from Oslo. Similar considerations were the basis for several of the new lines authorised by the Parliament of Norway from 1857.
During the construction period for these lines, which lasted until 1883, all new railways were State railways, organised as corporations. Private investors were invited to subscribe for shares that could provide dividends if there was a surplus. However, such investors were given no influence over the railway's operations. Rather, the Parliament insisted that it not only subscribe for a certain proportion of shares at the start of a project, but also have the power, at a later stage, to adopt the relevant line, and appropriate the remaining part of that line's initial capital.
In the years between 1862 and 1883, a series of more or less isolated lines was opened throughout southern Norway, including isolated railways in central and western Norway. The earliest railways were built to the (standard gauge) but to reduce costs under the influence of Carl Pihl this was changed to . The height of the era came in 1877 when Røros Line connected Central Norway to the capital.
In 1883, there was a pause in the construction of several railways. The same year, a new administrative system was launched for the State railways, with a main administration in Christiania and six district administrations in Christiania, Drammen, Hamar, Trondheim, Stavanger and Bergen. The term "De norske Statsbaner" was adopted in 1883, and in December 1885 the term "Norges Statsbaner" was used for the first time.
By the 1880s, after some mixed experiences with the model under which the Trunk Line was built, the State had control of Norwegian railway construction. However, a number of private public railways were opened in Norway between 1892 and 1956. Some of these were developed for the transport needs of individual businesses, while others were ordinary public railways to serve a specific district.
Private railways that were built for a specific company's needs remained in operation the longest. The remainder had, for the most part, already been closed during the interwar years, when they were ousted by road transport.
The turnaround in railway construction after 1883 was criticized by many. In the previous two decades, Norway had gained national expertise in railway construction. When the construction was stopped, there was a risk that this expertise would be lost.
In the second half of the 1880s, Norway had no shortage of railway plans and wishes. However, the great building boom of the 1870s had been financed in large part by government borrowings abroad. From 1890, there was a willingness to resume the construction of railways. After a few years, a boom was in full swing again, and it was perhaps even more ambitious than ever.
Three urban railways, in Oslo, Bergen and Trondheim, were started as horsecar systems between 1875 and 1893. They were all electrified around the turn of the century.
The second construction boom of the main railway arose in the 1910s and included the Bergen Line across Finse to Bergen, connecting eastern and western Norway. Also a number of other larger projects were built through the 1920s, including a second line, the Dovre Line, to Trondheim. This period also saw the first electrified railways and a steady conversion from Cape gauge to standard gauge. Norway chose to electrify its rail network at .
During World War II, the development of the network was a priority for the German occupation forces, as part of the creation of Festung Norwegen. Several lines were extended or constructed, with mostly poor quality results. In particular, the Nordland Line was extended a long distance to Dunderland, the Flåm Line was opened in 1941, and the entire Sørlandet Line was completed at Stavanger in 1944.
After the end of the war, the Nordland Line was extended all the way to Bodo. Upon the opening of that extension in 1962, Norwegian railway construction was complete, in the sense that all subsequent work can be regarded as modernization or capacity expansion of existing railways: Lieråstunnelen in 1973, Oslo Tunnel in 1980, Finse Tunnel in 1993, Ski–Sandbukta completed in 1996, the Gardermoen Line in 1998/1999, Gråskallen Tunnel on the Bergensbane in 1999, Kobbervik–Holm in 2001 and the Asker Line in 2005.
For most of the twentieth century, NSB had a near monopoly on rail operations in Norway. However, in 1996 the National Rail Administration (Norwegian: Jernbaneverket) was separated from the NSB, and given the task of maintaining the railway network. Since then, many different train companies have operated trains on the network.