Maritime flags are used on ships, boats and other water vessels. Flags that are used on the sea are considered very important and their use is strictly enforced with rules and regulations. There are different types of maritime flags for different purposes.
National flag that is flown at sea is called ensign. It is flown while entering and leaving the port, when it is demanded from the warship and while the ship is in the foreign waters along with the ensign of the country in which waters it sails. Warships are required to fly the ensign between the morning colors ceremony and sunset, while underway and in battle. When warship wishes to surrender it lowers the ensign.
Jack is a type of national flag is flown by warships at the head of the ship on special occasions.
Distinguishing mark is a type of maritime flag that is flown by ships that sail under the same national ensign but wish to distinguish themselves from ships under the different command. One of the examples are ships of the United States Coast and Geodetic Survey which fly distinguishing mark to differentiate from ships of the United States Navy.
The rank flag or distinguishing flag is the flag flown on a ship where is superior officer. That ship is then called flagship and tradition of using rank flags originates from time before electric communications when it was necessary to mark a ship which has command so other ships could know from which ship they will get commands.
Pennants are long and narrow flags that can have different meanings. Commissioning pennant is flown on the day of the commissioning of the ship and it is not flown not struck until the ship is decommissioned. The church pennant is a broad pennant that is flown during religious services. Gin pennant is a pennant that has a glass on it and is a signal that wardroom is inviting officers from ships in company to drinks.
House flags are flags flown by merchant ships that tell to which company ship belongs.
Special types of flags are signaling flags. Since the Middle Ages there were systems of communication between ships using flags but they were very primitive. In time they were improved and created in such a way that flags could spell message letter by letter or one flag could mean the whole standardized message. Flags are also used as semaphores where a signalmen holds two flags (one in each hand) and with relative positions of flags spells messages, letter by letter.
Yacht club burgee is a flag that is flown by members of a yacht club or sailing organization. Its flown from the main masthead or from a lanyard under the starboard spreader on the mast.
Courtesy flag is the ensign of a foreign country that is flown with an ensign of the country to which the ship belongs when the ship is in the waters of that foreign country. It is flown as a sign of respect.