The Ammer Valley Railway (Ammertalbahn) runs through the German state of Baden-Württemberg, connecting the university town of Tübingen with Herrenberg in the Böblingen district. It mostly runs through the valley of the Ammer river.
The Herrenberg–Pfäffingen section was opened on 12 August 1909, while the Pfäffingen–Tübingen section was delayed to 1 May 1910, partly because the construction of the Schlossberg tunnel had not been completed. The swampy ground in the Ammer valley also had to be treated, with 13 metre long oak logs being driven into the ground to stabilise the track.
The Ammer Vally Railway was established in 1911.
Deutsche Bundesbahn discontinued passenger services between Entringen and Herrenberg on 25 September 1966. The Entringen–Gültstein section continued to be operated for freight traffic until 31 January 1998, while the Gültstein–Herrenberg section was abandoned and eventually dismantled in 1973. The section, however, was never legally shut down and it did not pass out of rail ownership.
On 26 July 1995, the Zweckverband ÖPNV im Ammertal („municipal association for public transport in the Ammer valley“, ZÖA) was established and bought the line from Deutsche Bahn in 1996. The 4.1 km-long section between Gültstein and Herrenberg was rebuilt enabling the line to be reactivated for passenger services over its full length on 1 August 1999.