Ansbach (/ˈænzbæk/; German pronunciation: [ˈansbax]; East Franconian: Anschba) is a city in the German state of Bavaria. It is the capital of the administrative region of Middle Franconia. Ansbach is 40 kilometers (25 miles) southwest of Nuremberg and 140 kilometers (90 miles) north of Munich, on the river Fränkische Rezat, a tributary of the river Main. In 2020, its population was 41,681. The city has connections via autobahn A6 and highways and B14. Ansbach station is on the Nürnberg–Crailsheim and Treuchtlingen–Würzburg railways and is the terminus of line S4 of the Nuremberg S-Bahn.