Ajalvir is a town and municipality in the Autonomous Community of Madrid in central Spain. It lies in the comarca of Alcalá, roughly 26 kilometres (16 mi) north-east of the city of Madrid and about 12 kilometres (7.5 mi) from Alcalá de Henares.
The municipality is situated in the central part of the Madrid region, within the historic area associated with Alcalá de Henares. Its position places it among the towns of the north-eastern corridor of the Madrid metropolitan area, at a moderate distance from both the regional capital and the nearby city of Alcalá de Henares.
