El Escorial or the Royal Site of San Lorenzo de El Escorial, or Monasterio del Escorial, is a historical residence of the King of Spain, in the town of San Lorenzo de El Escorial, about 45 kilometres northwest of the Spanish capital, Madrid. It is one of the Spanish royal sites and functions as a monastery, basilica, royal palace, pantheon, library, museum, university, school and hospital. It is situated 2.06 km (1.28 mi) up the valley from the town of El Escorial.