The Royal Palace of Madrid (Spanish: Palacio Real de Madrid) is the official residence of the Spanish royal family at the city of Madrid, although now only used for state ceremonies. The palace has 135,000 square meters of floor space and contains 3,418 rooms. It is the largest functioning royal palace and the largest by floor area in Europe. King Felipe VI and the royal family do not reside in the palace, choosing instead the significantly more modest Palace of Zarzuela on the outskirts of Madrid. The palace is owned by the Spanish state and administered by the Patrimonio Nacional, a public agency of the Ministry of the Presidency.
The palace is located on the site of a 9th-century Alcázar ("Muslim-era fortress"), near the town of Magerit, constructed as an outpost by Muhammad I of Córdoba and inherited after 1036 by the independent Moorish Taifa of Toledo. After Madrid fell to King Alfonso VI of Castile in 1083, the edifice was only rarely used by the kings of Castile. In 1329, King Alfonso XI of Castile convened the cortes of Madrid for the first time. King Felipe II moved his court to Madrid in 1561. The old Alcázar was built on the location in the 16th century. After it burned 24 December 1734, King Felipe V ordered a new palace built on the same site. Construction spanned the years 1738 to 1755 and followed a Berniniesque design by Filippo Juvarra and Giovanni Battista Sacchetti in cooperation with Ventura Rodríguez, Francesco Sabatini, and Martín Sarmiento. King Carlos III first occupied the new palace in 1764.
The interior of the palace is notable for its wealth of art and the use of many types of fine materials in the construction and the decoration of its rooms. It includes paintings by artists such as Caravaggio, Juan de Flandes, Francisco de Goya, and Velázquez, and frescoes by Giovanni Battista Tiepolo, Corrado Giaquinto, and Anton Raphael Mengs. Other collections of great historical and artistic importance preserved in the building include the