A harbourmaster (or harbormaster, see spelling differences) is an official responsible for enforcing the regulations of a particular harbour or port, in order to ensure the safety of navigation, the security of the harbour and the correct operation of the port facilities.
Harbourmasters are normally responsible for issuing local safety information sometimes known as Notice to Mariners.
They may also oversee the maintenance and provision of navigational aids within the port, co-ordinate responses to emergencies, inspect vessels and oversee pilotage services.
The harbourmaster may have legal power to detain, caution or even arrest persons committing an offence within the port or tidal range of the port's responsibilities. An example of this is the team of Harbourmasters employed by the Port of London Authority who are empowered to undertake an enforcement role.
Actions that a harbourmaster may investigate include criminal acts, immigration, customs and excise, maritime and river safety and environmental and pollution issues. The police, customs, coastguard or immigration authorities will take over the handling of any offenders or incident once informed by the Harbourmaster.
A harbourmaster may either be a civilian or a commissioned naval officer of any rank.
Historically all harbourmasters were naval officers; even today they must possess prior seafaring knowledge and experience through serving with either a Merchant Navy or Armed Navy.
The term "Naval" and "civilian" are used here to distinguish who is employed by a military force and who is employed by a public or private port.
In the United Kingdom, when a person has been appointed to superintend a Dockyard Port  the officer serves in this capacity as the Queen's (or King's) Harbourmaster, and is entitled to fly a white-bordered Union Flag with a white central disc bearing the initials "QHM" (or "KHM" during the reign of a King) beneath a crown. Although legislation does not require it, most QHMs are serving officers in the Royal Navy. Equivalent positions also exist in Canada, where a Queen's Harbourmaster is known in French as capitaine de port de Sa Majesté (literally "Her Majesty's Captain of the Port").
Nowadays the former post of Harbourmaster of the Port of London Authority, and indeed many other large ports, is Chief Harbourmaster, who command a team of Harbourmasters because of the size of the port.
In the United States, the Captain of the Port, a United States Coast Guard officer, is responsible for these duties in a pre-defined Captain of the Port zone which usually includes multiple ports and waterways leading to those ports, usually in federal waters. A US Captain of the Port, unlike the Canadian capitaine de port, is not normally considered to be a harbourmaster, as harbourmasters in the United States (as elsewhere) are usually local government officials responsible for safety and security in a harbour.
- California Association of Harbor Masters
- New York State Harbormaster and Bay Constable Association
- Queen's Harbourmaster Portsmouth, Plymouth and Clyde