Ayerbe is located 28 km from Huesca on highway A 132 in the direction of Pamplona, on the Gállego river. It is bounded by Riglos crags and the Santo Domingo range of hills to the north; to the east by the villages of Loarre and Loscorrales; to the south by the villages of Lupiñén-Ortilla, and to the west by the villages of Biscarrues and Murillo de Gállego. It is located at , with a height above sea level of Alicante of 582 m. and an area of 63.29 square kilometres. It is located in an excavated erosive depression in the surface of the Tertiary period.