The Dean of the Chapel Royal, in any kingdom, can be the title of an official charged with oversight of that kingdom's chapel royal, the ecclesiastical establishment which is part of the royal household and ministers to it.
In England, the Dean of the Chapel Royal was appointed by royal warrant and appointed its officers and staff. The office of dean (dating from 1312) has been by custom held by the Bishop of London since 1748. In practice, the chapel, its choir, and the various chapel buildings associated with it come under the oversight of the Sub-Dean, who is the Queen's residential chaplain.
In Scotland, the title first appears in the fifteenth century, when it may have referred to a prebend in the church of St Mary on the Rock, St Andrews. In 1501 James IV founded a new Chapel Royal in Stirling Castle, but from 1504 onwards the deanery was held by successive Bishops of Galloway with the title of Bishop of the Chapel Royal and authority over all the royal palaces within Scotland. The deanery was annexed to the bishopric of Dunblane in 1621, and the Chapel Royal was removed to Holyrood.
The office of Dean was suppressed with the abolition of prelacy in 1689, and the revenues of the Chapel Royal reverted to the Crown. Grants from these revenues were made to individual Church of Scotland ministers and from 1727 onwards part was allocated to three royal chaplains, known collectively as the Deans of the Chapel Royal. Replacement of these chaplains by professors of the Divinity Faculties in the University of Glasgow, the University of Aberdeen, Edinburgh University and the University of St Andrews took place between 1860 and 1868. In 1886 the office of Dean was revived and united by royal warrant to that of Dean of the Thistle, eventually being separated in 1969. Under the 1886 royal warrant, the Dean is also titular Abbot of Crossraguel and Abbot of Dundrennan.