Beginning in 1917, steam locomotives, which consume large amounts of fuel (wood, coal, and later oil) and even more water, were gradually retired and replaced by diesel from the 1920s. Railway electrification started in the 1880s onwards, which required much more infrastructure (for power generation, grid, and Overhead lines) before electric locomotives could come in use. The timeframe of these processes varied by country. Leading electrification was Switzerland, having 50% of the grid electrified by 1928, with long Trans-Alpine tunnels, steep inclines, small radius turns, and the availability of hydro electric power but lack of domestic coal mines.
Railfan & Railroad stated in 2022 that "the only places on earth to see steam locomotives in revenue freight service are small switching operations in China, North Korea and Bosnia," but that these were "sporadic at best." While the use of steam locomotives in mainline service has largely come to an end, preserved steam trains are still in regular use around the world. Attempts to use steam engines in selected regular scheduled services are called Plandampf.
North and South America
United States
The first diesel-electric locomotives appeared on the Central Railroad of New Jersey in 1925 and on the New York Central in 1927. Moving forward, diesel locomotives began to appear in mainline service in the United States in the mid-1930s.The Pioneer Zephyr first ran in 1934. Compared to steam, diesel power reduced maintenance costs dramatically while increasing locomotive availability. On the Chicago, Rock Island and Pacific Railroad, new units delivered over a year, compared with about for a mainline steam locomotive. World War II delayed dieselisation in the US until the late 1940s; in 1949, the Gulf, Mobile and Ohio Railroad became the first large mainline railroad to convert completely to diesel locomotives, and Life Magazine ran an article on 5 December 1949 titled "The GM&O puts all its steam engines to torch, becomes first major US railroad to dieselize 100%". The manufacture of new steam locomotives for stateside use decreased as dieselization continued. The Lima Locomotive Works was perhaps the last commercial builder of steam locomotives, with the final order completed being for ten “Berkshires” for the New York, Chicago & St. Louis Railroad in 1949. The last steam locomotive manufactured for general service in the United States would follow in 1953: a Norfolk and Western , built in the railroad's Roanoke Shops.
1960 is normally considered the final year of regular Class 1 main line standard gauge steam operation in the United States, with operations on the Grand Trunk Western, Illinois Central, Norfolk and Western, and Duluth Missabe and Iron Range Railroads,Stagner, 1991 National Ry. Bul. Vol. 56 #4. as well as Canadian Pacific operations in Maine.Holland, 2006 Canadian Pacific Steam, Vol. 1. The Grand Trunk Western did, however, use some steam power for regular passenger trains until 1961, the last instance of this occurring unannounced on trains 56 and 21 in the Detroit area on 20 September 1961 with 6323, one day before its flue time expired.Stagner, 1991; Pinkepank, 2003 Grand Trunk Western Vol. 1. The last steam-powered standard-gauge regular freight service by a class 1 railroad came little over a year later on the isolated Leadville branch of the Colorado and Southern (Burlington Route) on 11 October 1962 with 2-8-0 641.Stagner, 1991. Narrow-gauge steam was used for freight service by the Denver and Rio Grande Western on the run from Alamosa, Colorado, to Farmington, New Mexico, via Durango until service ceased on 6 December 1968. The Denver and Rio Grande Western would keep its narrow gauge steam power active, however isolated from its main network, until in 1981 when Florida business man Charles Bradshaw bought the Durango and Silverton line from the D&RGW and renamed it the Durango and Silverton Narrow Gauge Railroad with its first season starting in 1982.
The Union Pacific Railroad is the only Class I railroad in the US to have never completely dieselised, at least nominally. It has always had at least one operational steam locomotive, Union Pacific 844, on its roster.
A study conducted on the economics, as well as unforeseen disadvantages of dieselisation, was written on America's railways by Dr. H. F. Brown.
Some US shortlines continued steam operations into the 1960s and beyond; the Northwestern Steel and Wire mill in Sterling, Illinois continued to operate steam locomotives until December 1980, and the Crab Orchard and Egyptian Railway, which had used steam since its inception in 1973, continued until September 1986. By this time, around 1,800 of the over 160,000 steam locomotives built in the United States between 1830 and 1950 still existed, with a fraction still in operating condition at museums, on tourist railroads, or in use on mainline excursions.
Mexico On the contiguous North American standard gauge network across Canada, Mexico and the United States, the use of standard gauge main line steam locomotion using s built in 1946 for handling freight between Mexico City and Irapuato lasted until 1968. The Mexican Pacific line, a standard gauge short line in the state of Sinaloa, was reported in August 1987(World Steam Magazine #101) to still be using steam, with a roster of one , two s and one .
Other countries In Paraguay, wood-burning steam locomotives operated until 1999.
Europe
Britain
Trials of diesel locomotives and railcars began in Britain in the 1930s but made only limited progress. One problem was that British diesel locomotives were often seriously under-powered compared with the steam locomotives against which they were competing. Moreover, labour and coal were relatively cheap.
After 1945, problems associated with post-war reconstruction and the availability of cheap domestic-produced coal kept steam in widespread use throughout the two following decades. However the ready availability of cheap oil led to new dieselisation programmes from 1955, and these began to take full effect from around 1962. By then it was apparent that steam locomotives had reached their limit in terms of power within the restrictive British loading gauge, with no scope for larger boilers or cylinders even if mechanical firing were to be employed. Towards the end of the steam era, steam motive power fell into a state of disrepair. The last steam locomotive built for mainline British Railways was 92220 Evening Star, which was completed in March 1960.British Railways' Last Steam Locomotive Railway Gazette 23 March 1960 p. 355 The last steam-hauled service trains on the British Railways network ran on 11 August 1968, but the use of steam locomotives in British industry continued into the 1980s. In June 1975, there were still 41 locations where steam was in regular use, and many more where engines were maintained in reserve in case of diesel failures. Gradually, the decline of the ironstone quarries, steel, coal mining and shipbuilding industries – and the plentiful supply of redundant British Rail diesel shunters as replacements – led to the end of steam power for commercial uses.
Several hundred rebuilt and preserved steam locomotives are still used on preserved volunteer-run 'heritage' railway lines in the UK. A proportion of the locomotives are regularly used on the national rail network by private operators where they run special excursions and touring trains. A new steam locomotive, the LNER Peppercorn Class A1 60163 Tornado has been built (began service in 2009). The builders of this locomotive, the A1 Steam Locomotive Trust have a second new steam locomotive nearing completion, a LNER Class P2 2-8-2 class locomotive to be named Prince of Wales and plans for a LNER Class V4 2-6-2 are in place following the completion of Prince of Wales.
Also in the Isle of Man Steam traction continues on the Government owned Isle of Man Railway to the present day.
Germany After the Second World War, Germany was divided into the Federal Republic of Germany, with the Deutsche Bundesbahn (founded in 1949) as the new state-owned railway, and the German Democratic Republic (GDR), where railway service continued under the old pre-war name Deutsche Reichsbahn.
For a short period after the war, both the Bundesbahn (DB) and Reichsbahn (DR) still placed orders for new steam locomotives. They needed to renew the rolling stock, mostly with steam locomotives designed for accelerated passenger trains. Many of the existing predecessors of those types of steam locomotives in Germany had been lost in the battles or simply reached the end of their lifetime, such as the famous Prussian P 8. There was no need for new freight train engines, however, because thousands of the Classes 50 and 52 had been built during the Second World War.
Because the concept of the so-called "Einheitslokomotiven", the standard locomotives built in the 1920s and 1930s, and still in wide use, was already outdated in the pre-war era, a whole new design for the new steam locomotives was developed by DB and DR, called "Neubaudampflokomotiven" (new-build steam locomotives). The steam locomotives made by the DB in West Germany, under the guidance of Friedrich Witte, represented the latest evolution in steam locomotive construction including fully welded frames, high-performance boilers and roller bearings on all moving parts. Although these new DB classes (10, 23, 65, 66 and 82) were said to be among the finest and best-performing German steam locomotives ever built, none of them exceeded 25 years in service. The last one, 23 105 (still preserved), went into service in 1959.
The Democratic Republic in East Germany began a similar procurement plan, including engines for a narrow gauge. The DR-Neubaudampflokomotiven were the classes 23.10, 25.10, 50.40, 65.10, 83.10, 99.23-24 and 99.77-79. The purchase of new-build steam locomotives by the DR ended in 1960 with 50 4088, the last standard-gauge steam locomotive built in Germany. No locomotive of the classes 25.10 and 83.10 was in service for more than 17 years. The last engines of the classes 23.10, 65.10 and 50.40 were retired in the late 1970s, with some units older than 25 years. Some of the narrow-gauge locomotives are still in service for tourism purposes. Later, during the early 1960s, the DR developed a way to reconstruct older locomotives to conform with contemporary requirements. The high-speed locomotive 18 201 and the class 01.5 are examples of designs from that programme.
Around 1960, the Bundesbahn in West Germany began to phase out all steam-hauled trains over a period of ten years, but still had about 5,000 of them in running condition. Even though DB were very assertive in continuing the electrification on the main lines – in 1963 they reached of electrified routes – and dieselisation with new developed stock, they had not completely removed steam locomotives within the ten-year goal. In 1972, the Hamburg and Frankfurt departments of the DB rail networks became the first to no longer operate steam locomotives in their areas. The remaining steam locomotives began to gather in rail yards in Rheine, Tübingen, Hof, Saarbrücken, Gelsenkirchen-Bismarck and others, which soon became popular with rail enthusiasts.
In 1975, DB's last steam express train made its final run on the Emsland-Line from Rheine to Norddeich in the upper north of Germany. Two years later, on 26 October 1977, the heavy freight engine 44 903 (computer-based new number 043 903–4) made her final run at the same railway yard. After this date, no regular steam service took place on the network of the DB until their privatisation in 1994.