The British Army had regiments of both Horse Guards and Foot Guards predating the English Restoration (1660), and, since the reign of King Charles II, these have been responsible for guarding the Sovereign Palaces.
The Queen has a number of homes, both official (Buckingham Palace, St James's Palace, Windsor Castle and Holyrood House in Scotland) and private (Sandringham and Balmoral), but it is only at the London and Windsor Palaces and Holyroodhouse that a guard is mounted.
The Queen's Guard in London changes in the Forecourt of Buckingham Palace at 11:30am every day in the summer and every other day in the winter. The Guard comprises two detachments, one each for Buckingham Palace and St James's Palace, under the command of the Captain of The Queen's Guard.
St James's Palace
After Whitehall Palace was burnt down in 1698, St James's Palace became the official residence of the Sovereign and ever since it has remained at the centre of the Court. Foreign ambassadors are still accredited to the Court of St James's. Besides, the Palace embraces Marlborough House, which was occupied by both Queen Alexandra and Queen Elizabeth the Queen Mother. As St James's Palace is still the official residence of the Court, it is here that the Colour is lodged and where also the Captain of the Guard establishes his headquarters.
One of the public duties battalions is responsible for providing the guard at Windsor Castle. The location of the ceremony at Windsor varies; in the summer, when the Queen is in residence it usually takes place on the lawn in the Castle's quadrangle. In wet weather or winter to protect the lawn, or when the Queen is not in residence, the ceremony occurs outside the Guardroom by Henry VIII's Gateway at the foot of Castle Hill.
Tower of London
A detachment of the regiment on guard at Buckingham Palace and St James's Palace is also responsible for providing the guard at the Tower of London. As the Tower is still officially a royal residence, and is also the location of the crown jewels, it remains the army's obligation to guard it. The Tower guard numbers one officer, 6 NCOs and 15 soldiers, and usually posts a sentry outside the Jewel House and one outside the Queen's House. As the protection of the Tower is their responsibility (in conjunction with the Yeomen Warders, and the Jewel House wardens), the guard must also see it is secure at night.
The Guard is also mounted in Edinburgh at the Palace of Holyroodhouse, the Queen's official residence in Scotland, and at Edinburgh Castle. Unlike in London, there is no Guards battalion permanently based in the city, so the guard is provided by whichever the resident infantry battalion is at Redford Barracks in the city. The guard is not mounted throughout the year - it is usually mounted daily during the week that the Queen spends at the palace (prior to her summer break at Balmoral), and during the Lord Commissioner's Week.
Sentries are posted on the Esplanade at the entrance of the castle at the same time as the guard at the Palace, or when there is a royal visitor to Edinburgh. Sentries are also posted during the month of the Edinburgh Military Tattoo, usually from a unit that has an anniversary from the year.