The Munich–Buchloe railway is a double-track, electrified main line in Bavaria, Germany. The 60 kilometre-long line runs from via and to . Together with the Buchloe–Kempten–Lindau line, it is known as the Allgäubahn (Allgäu railway). The line is owned and maintained by DB Netz.

The Royal Bavarian State Railways (Königlich Bayerische Staatseisenbahnen) opened the line between 1872 and 1873 as part of the Munich–Memmingen line. From the beginning, the line was of great importance for international long-distance traffic between Munich and Switzerland and was duplicated along its entire length from 1899 to 1906. The section from Munich-Pasing to Geltendorf was electrified in 1968 and has been served by the Munich S-Bahn since 1972. Deutsche Bahn electrified the remaining section from Geltendorf to Buchloe as part of the upgrade of the Munich–Memmingen–Lindau line, completed in 2020.

History After the opening of the Ludwig South-North Railway (Ludwig-Süd-Nord-Bahn) from Hof via Augsburg to Lindau, additional Bavarian government railway lines were initially built with no regard for the creation of an integrated railway network. At the beginning of the 1860s, the headquarters of the Royal Bavarian State Railways (Generaldirektion der Königlichen Verkehrsanstalten) first considered a more systematic approach in order to complete the Bavarian railway network and increase its flexibility for use for passengers, freight and the military.

The line from Munich to Memmingen via Buchloe was listed as one of 19 proposed railways in a bill that the Ministry of Trade and Public Works submitted to the Chamber of Deputies of the Bavarian Parliament on 28 January 1868. The only railway connecting to the west from Munich until then was the Munich–Augsburg–Ulm line, meaning that Kempten, Memmingen and Lindau could only be reached from Munich with a considerable detour via Augsburg or Neu-Ulm. The new line would therefore produce a significantly shorter connection to the Ludwig South-North railway in Buchloe and the Neu-Ulm–Kempten railway in Memmingen. From 1869, there were plans to extend the line from Memmingen through Württemberg to Hergatz to create a shorter alternative to the Ludwig South-North railway. Under the law of 29 April 1869, the Bavarian State Parliament approved the construction of 22 new railway lines, including the line from Munich to the Württemberg border via Buchloe and Memmingen. With an estimated construction cost of 13 million guilders, it was the third most expensive project of the proposed new railways.

Since the Kingdom of Württemberg did not permit its extension beyond the border, the line was initially planned only as far as Memmingen. The construction department of the headquarters of the Royal Transport Authority (Königlichen Verkehrsanstalten), which was responsible for the planning, determined the route based primarily on economic and topographical criteria: to avoid steep inclines and to build as few complex engineering structures as possible, some stations had to be located far away from the locations they served.

The town of Landsberg am Lech had campaigned for a route via Sandau about one kilometre north of Landsberg's old town as early as 1863. With the approval of the headquarters of the Transport Authority, the town drew up its own plan for a route from Pasing via Stegen on the Ammersee and Landsberg to Buchloe. However, due to the risk of flooding in the Ampermoos and on the banks of the Ammersee as well as the large difference in altitude on the steep bank of the Lech near Sandau, the transport authority rejected this route. Instead, it planned a route further north via Bruck (now Fürstenfeldbruck) and Grafrath with a Lech crossing near Kaufering, which it considered to be considerably cheaper due to a 13 metre reduction in the difference of heights. The detailed planning of the route from Munich to Kaufering began in 1869. However, the town of Landsberg continued to call for a crossing of the Lech near Sandau and offered to cover part of the costs for this route. In October 1870, the headquarters of the Transport Authority finally chose the route via Kaufering to minimise costs. Landsberg would be connected by a branch from the main line in Kaufering.

Construction and commissioning Between December 1869 and February 1870, the Transport Authority divided the construction of the line into three sections based on Bruck, Landsberg and Buchloe. Railway construction director Karl von Dyck took over the management of the construction, while Alois Röckl was the technical consultant. Construction of the first earthworks for the line began at the end of 1869. The line was prepared for two tracks from the start, but initially it only had one track. Major earthworks and bridges were required in several places due to the hilly terrain and the rivers that had to be crossed. At Bruck, a cutting through the Engelsberg had to be dug 36 metres deep and a 12 metre high bridge had to be built over the Amper.

The most elaborate work took place in the Landsberg construction section: a 114 metre bridge was built over the Lech near Kaufering, which, with construction costs of 313,000 guilders, was the most expensive structure on the line. In order to compensate for the difference in altitude between the high bank to the east of the Lech and the lower bank to the west, the Landsberg section included a two-kilometre-long cutting east of the river with a maximum depth of 15 metres and a two-kilometre-long, up to 22 metres-high embankment to the west. Over 400,000 cubic metres of material were moved, requiring up to 200 workers. A Feldbahn (field railway) was used to transport the excavated material from the east to the west bank, for which the building gang erected a temporary wooden trestle bridge over the Lech south of the permanent bridge.

The Royal Bavarian State Railways opened the first 11.81 kilometre-long section from Kaufering to Buchloe and the branch from Kaufering to Landsberg on 1 November 1872. The Lech bridge near Kaufering was completed in March 1873; the strength test on the bridge was carried out on 9 March 1873. As a result, the Bavarian State Railways were able to start operations on the 56.18 kilometre-long section from Munich to Kaufering via Pasing on 1 May 1873. The extension from Buchloe to Memmingen was opened on 1 May 1874. The cost of the construction for the entire Munich–Memmingen line, including the branch line to Landsberg, amounted to 21,839,273 marks.

Operations before the Second World War When it opened, the Munich–Buchloe main line had six stations in Pasing, Bruck, , , and and four Haltstellen (halts) in Aubing, Schwabhausen, Epfenhausen and Igling.

The line had significant traffic from the start. Together with the Buchloe–Lindau line, it was part of the fastest route between Munich and Switzerland and was therefore used by international long-distance passenger and freight trains from its opening. The Munich–Memmingen line, however, did not initially achieve as much traffic as initially hoped because of the lack of an extension from Memmingen towards Württemberg. With the opening of the Arlberg Railway from Innsbruck to Bludenz in 1884, the Munich–Buchloe line lost international freight traffic between Austria and Switzerland.

The Bavarian State Railways introduced suburban services between Munich and Bruck (Fürstenfeldbruck since 1908) on 1 May 1896, which were used to transport schoolchildren and commuters to the city. For this, it opened the halts of and Roggenstein between the stations of Aubing and Bruck. On 1 May 1899, the Bavarian State Railways completed a second track on the Pasing–Bruck section, which was heavily used by suburban traffic.

Due to the increasing volume of traffic, the Bavarian State Railways duplicated the rest of the line from 1905. Since the entire length of the line had already been prepared for two tracks, the work was completed within a year. The second track went into operation from Bruck to Grafrath on 21 November 1905, from Grafrath to on 27 April 1906, from Igling to Buchloe on 28 April and from Türkenfeld to Epfenhausen on 29 May. With the completion of the remaining intermediate section from Epfenhausen to Igling, the entire line was double-track from 29 September 1906.

In 1939, Dynamit AG (DAG) began building an ammunition factory southwest of Kaufering, which was connected to Kaufering station via a siding. Deutsche Reichsbahn significantly upgraded the tracks in Kaufering for the expected increase in freight traffic. A third track was built between Kaufering and Igling to the south of the two main tracks from 1939 to connect another planned ammunition factory near Igling. In the course of the Second World War, however, work on both factories was stopped at the end of 1940 and the third track was therefore not completed. For the construction of the Weingut II and Diana I bunkers as part of the Ringeltaube armaments project, DAG's existing sidings were extended to the bunker construction sites and an additional connection was built to the main line between Kaufering and Igling in 1944. Prisoners from the Kaufering concentration camp complex were used as forced labourers in the construction of the sidings.

With the approach of the American troops at the end of April 1945, the Schutzstaffel transported the prisoners of the Kaufering satellite camps in freight wagons over the Munich–Buchloe line to Dachau concentration camp. A train with 3,500 prisoners near Schwabhausen bei Landsberg was strafed by an American fighter, killing over 100 prisoners, on 27 April 1945. Other prisoners were shot by the SS while they were fleeing. In order to prevent the advance of the American soldiers, the Wehrmacht tried to blow up the Lech Bridge near Kaufering on 27 April and the bridge was badly damaged. On the night of 28–29 April 1945, a Wehrmacht commando blew up the Amper bridge near Fürstenfeldbruck. The entire line was taken by American troops by 30 April 1945. It was not until the winter of 1945/46 that Deutsche Reichsbahn was able to resume continuous train operations between Munich and Buchloe, initially on a single track.

Reconstruction for the S-Bahn and electrification Prior to the introduction of the V 200 diesel locomotive in the mid-1960s, which reduced travel times between Munich and Lindau by around 30 minutes, the line was operated with steam locomotives. Bavarian S 3/6 (later class 18) locomotives hauled high-quality, international express services on the line for many decades. They were still used for express services at the end of 1967.

In 1967, Deutsche Bundesbahn began converting the section between Munich and for S-Bahn operations. Work on electrification of the section at 15 kV AC began in the summer of 1967. An overhead line of the Re 160 type (designed for operations up to 160km/h) was installed. Deutsche Bundesbahn began operating electric trains on local services between Munich and Geltendorf on 29 September 1968. The electrification reduced travel time from 78 to 40 minutes. In addition, Deutsche Bundesbahn replaced the mechanical signal box along the section by push-button relay interlockings and equipped the future S-Bahn stations with new 76 cm high and 210 m long platforms. The Munich S-Bahn began operations on 28 May 1972 as line S4, with trains running every 40 minutes to Geltendorf.

Deutsche Bundesbahn reduced passenger train stops in Schwabhausen, Epfenhausen and Igling on the Geltendorf–Buchloe section. In Schwabhausen and Epfenhausen access to some platforms was still across the tracks, which posed a safety risk when trains were passing through at speeds of up to 140 km/h. Because of this, and because of the low number of passengers, Deutsche Bundesbahn ended passenger services at all three stations on 29 September 1985.