Salute by gunfire is an ancient ceremony.
The tradition of saluting can be traced to the Middle Ages practice of placing oneself in an unarmed position and, therefore, in the power of those being honored. This may be noted in the dropping of the point of the sword, presenting arms, firing cannon and small arms, lowering sails, manning the yards, removing the headdress or laying on oars.
The gun salute might have originated in the 17th century with the maritime practice of demanding that a defeated enemy expend its ammunition and render itself helpless until reloaded — a time-consuming operation in that era.
The system of odd numbered rounds is said to have been originated by Samuel Pepys, Secretary to the Navy in the Restoration, as a way of economizing on the use of powder, the rule until that time having been that all guns had to be fired. Odd numbers were chosen, as even numbers indicated a death.
21-Gun salutes mark special royal occasion throughout the United Kingdom and the Commonwealth, referred to as a "Royal Salute" (in the British Empire it was reserved, mainly among colonial princely states, for the most prestigious category of native rulers of so-called salute states), unless rendered to the president or flag of a republic; nonetheless salutes rendered to all heads of state regardless of title are casually referred to as "royal" salutes.
The number of rounds fired in a salute depend on the place and occasion. The basic salute is 21 rounds. In Hyde Park and Green Park an extra 20 rounds are added because they are Royal Parks.
Gun salutes occur on:
Gun salutes also occur when Parliament is prorogued by the Sovereign, on Royal births and when a visiting Head of State meets the Sovereign in London, Windsor or Edinburgh.