Both public and private buildings such as schools and courthouses may fly the national flag. In some countries, the national flags are only flown from non-military buildings on certain flag days. There are three distinct types of national flag for use on land, and three for use at sea, though many countries use identical designs for several (and sometimes all) of these types of flag.
Historically, flags originate as military standards, used as field signs. The practice of flying flags indicating the country of origin outside of the context of warfare emerges with the maritime flag, introduced during the age of sail, in the early 17th century. The origins of the Union Jack flag date back to 1603, when James VI of Scotland inherited the English and Irish thrones (as James I), thereby uniting the crowns of England, Scotland and Ireland in a personal union (which remained separate states). On 12 April 1606, a new flag to represent this regal union between England and Scotland was specified in a royal decree, according to which the flag of England (a red cross on a white background, known as St George's Cross), and the flag of Scotland (a white saltire on a blue background, known as the Saltire or St Andrew's Cross), would be joined together, forming the flag of Great Britain and first union flag.
With the emergence of nationalist sentiment from the late 18th century the desire was felt to display national flags also in civilian contexts, notably the US flag, in origin adopted as a naval ensign in 1777, which after the American Revolution[year needed] began to be displayed as a generic symbol of the United States, and the French Tricolore which became a symbol of the Republic in the 1790s.
Most countries of Europe adopted a national flag in the course of the 19th and early 20th centuries, often based on older (medieval) war flags. For example, the flag of Denmark was introduced in 1854, based on a 17th century design. The flag of Switzerland was introduced in 1889, also based on medieval war flags. The Netherlands introduced two national flags in 1813 (either an orange-white-blue or a red-white-blue tricolour; the final decision in favour of red was made in 1937). The non-European powers followed the trend in the late 19th century, the flag of Japan being introduced in 1870, that of Qing China in 1890. Also in the 19th century, most countries of South America introduced a flag as they became independent (Peru in 1820, Bolivia in 1851, Colombia in 1860, Brazil in 1822, etc.) Afghanistan had more changes of its national flag during the 20th and 21st centuries than any other country in the world, having 21 flags from 1901 to the present.
National flags on land 
On land, there is a distinction between civil flags (FIAV symbol ), state flags (), and war or military flags (). State flags are those used officially by government agencies, whereas civil flags may be flown by anyone regardless of whether he/she is linked to government. War flags (also called military flags) are used by military organizations such as Armies, Marine Corps, or Air Forces.
In practice, many countries (such as the United States and the United Kingdom) have identical flags for these three purposes; national flag is sometimes used as a vexillological term to refer to such a three-purpose flag (). In a number of countries, however—notably those in Latin America—there is a distinct difference between civil and state flags. In most cases, the civil flag is a simplified version of the state flag, with the difference often being the presence of a coat of arms on the state flag that is absent from the civil flag.
Very few countries use a war flag that differs from the state flag. The People's Republic of China, the Republic of China (Taiwan), and Japan are notable examples of this. Swallow-tailed flags are used as war flags and naval ensigns in Nordic countries and charged versions as presidential or royal standards. The Philippines does not have a distinctive war flag in this usual sense, but the flag of the Philippines is legally unique in that it is flown with the red stripe on top when the country is in a state of war, rather than the conventional blue.
National ensigns at sea 
The flag that indicates nationality on a ship is called an ensign. As with the national flags, there are three varieties: the civil ensign (), flown by private vessels; state ensigns (also called government ensigns; ), flown by government ships; and war ensigns (also called naval ensigns; ), flown by naval vessels. The ensign is flown from an ensign-staff at the stern of the ship, or from a gaff when underway. Both these positions are superior to any other on the ship, even though the masthead is higher. In the absence of a gaff the ensign may be flown from the yardarm. (See Maritime flags.) National flags may also be flown by aircraft and the land vehicles of important officials. In the case of aircraft, those flags are usually painted on, and those are usually to be painted on in the position as if they were blowing in the wind.
In some countries, such as the United States and Canada, the national ensign is identical to the national flag, while in others, such as the United Kingdom and Japan, there are specific ensigns for maritime use. Most countries do not have a separate state ensign, although the United Kingdom is a rare exception, in having a red ensign for civil use, a white ensign as its naval ensign, and a blue ensign for government non-military vessels.
Similar flags 
Although the national flag is meant to be a unique symbol for a country, many pairs of countries have highly similar and thus easily confusable flags. Examples include the flags of Monaco and of Indonesia, which differ only slightly in proportion; of the Netherlands and of Luxembourg, which differ in proportion as well as in the tint of blue used; and of Romania and of Chad, which differ only in the tint of blue.
There are three color combinations that are used on several flags in certain regions. Blue, white, and red is a common combination in Slavic countries such as the Czech Republic, Slovakia, Russia, Serbia, Slovenia, and Croatia as well as among Western nations including Australia, France, Iceland, Norway, New Zealand, the United Kingdom, the Netherlands and the United States of America. Many African nations use red, yellow, and green, including Ghana, Cameroon, Mali and Senegal. Flags containing red, white, and black can be found particularly among the Arab nations such as Egypt, Iraq and Yemen.
While some similarities are coincidental, others are rooted in shared histories. For example, the flags of Venezuela, of Colombia, and of Ecuador all use variants of the flag of Gran Colombia, the country they composed upon their independence from Spain, created by the Venezuelan independence hero Francisco de Miranda; and the flags of Egypt, of Iraq, of Syria, and of Yemen are all highly similar variants of the flag of the Arab revolt of 1916–1918. The flags of Romania and Moldova are virtually the same, because of the common history and heritage. Moldova adopted the Romanian flag during the declaration of independence from the USSR in 1991 (and was used in various demonstrations and revolts by the population) and later the Moldovan coat of arms (which is part of the Romanian coat of arms) was placed in the center of the flag. The Nordic countries all have the same design (Iceland, Denmark, Norway, Sweden, Finland, in addition to the autonomous regions of the Faroe Islands and Åland), a horizontal cross on a single-colored background. The United States and United Kingdom both have red, white, and blue. This similarity is due to the fact that the first 13 states of the U.S. were former colonies of the United Kingdom. Also, Australia and New Zealand share a very similar flag, which stems from their joint British heritage. Both flags feature the Union Jack in one corner, both have royal blue background, and both have the Southern Cross as a prominent feature. The only differences between these flags is that the Australian flag has the Commonwealth Star below the canton, and that on the New Zealand flag, just four stars in the Southern Cross are presented, and they are five-pointed red stars with white borders. On the other hand, all five stars of the Southern Cross are presented on the Australian flag, and they are white with seven points, except for the additional smaller fifth star in the Southern Cross which has only five points on this flag. Some similarities to the United States flag with the red and white stripes are noted as well such as the flag of Malaysia and the flag of Liberia, the latter of which was an American resettlement colony.
Many other similarities may be found among current national flags, particularly if inversions of color schemes are considered (e.g., compare the flag of Côte d'Ivoire to that of Ireland and Indonesia and Poland. Still more identical or closely similar pairs exist comparing present day and historical flags; for example, the current national flag of Albania was the war flag of the Byzantine (Eastern Roman) Empire.
Unusual flags 
- The flag of Nepal is the only national flag which is non-rectangular as well as being the only national flag that is taller than it is wide.
- The flags of Switzerland and the Vatican City are the only national flags which are exact squares.
- The flag of Togo is the only rectangle national flag (also in history) with an irrational proportion — its ratio of lengths is the golden ratio.
- The flag of the Libyan Arab Jamahiriya during its period of use (1977–2011) was the only national flag consisting just of a single solid color (green) with no other designs or symbols.
- The flags of Cyprus and Kosovo (and that of the Australian territory of Christmas Island) are the only national flags which depict the shape of the area that they represent (the Korean Unification Flag depicts the Korean Peninsula, although it is not an official flag in either North or South Korea). There are many proposals for a future flag of a dejure independent Taiwan which also depict the shape or map of the island of Taiwan (Formosa). None of them is the official flag of the Republic of China yet, and many design options are present. Additionally, the flag of Tuvalu has nine stars arranged in a geographically accurate pattern representing the nine islands of the nation.
- The flag of Paraguay is not identical on its obverse and reverse sides.
- The flag of Mozambique is the only national flag to incorporate a modern firearm into its design (an AK-47). The flag of Guatemala has two rifles forming part of the coat of arms displayed as an insignia; however, these are Remington rifles dating from 1871.
- The flag of the Philippines is the only flag which may be hoisted upside-down when the Filipino Congress has declared the nation to be in a "state of war". The reverse case is true for peacetime, when the flag is hoisted with blue stripe over the red. The peacetime arrangement is the more conventional method for displaying this flag unless the situation calls for otherwise.
- The flag of Afghanistan and the flag of Ecuador, as well as the flag of the Ethiopian Empire (1137–1974), are unusual in that their designs contain representations of themselves. The emblem of Afghanistan, located in the center of the Afghan flag, has two national flags within it.
Flag protocol 
There is a great deal of protocol involved in the proper display of national flags. A general rule is that the national flag should be flown in the position of honor, and not in an inferior position to any other flag (although some countries make an exception for royal standards). The following rules are typical of the conventions when flags are flown on land.
- When a national flag is displayed together with any other flags, it must be hoisted first and lowered last.
- When a national flag is displayed together with the national flags of other countries, all the flags should be of approximately equal size and must be flown at an equal height, although the national flag of the host country should be flown in the position of honor (in the center of an odd number of flagstaffs or at the far right — left from an observer's point of view — of an even number of flagstaffs).
- When a national flag is displayed together with flags other than national flags, it should be flown on a separate flagstaff, either higher or in the position of honor.
- When a national flag is displayed together with any other flags on the same flagstaff, it must be at the top, though separate flagstaffs are preferable.
- When a national flag is displayed together with any other flag on crossed staffs, the national flag must be on the observer's left and its staff must be in front of the staff of the other flag.
- When a national flag is displayed together with another flag or flags in procession, the national flag must be on the marching right. If there is a row of flags, it should be in the position of honor.
- When a national flag, with some exceptions, is flown upside down it indicates distress. This however is merely tradition. It is not a recognised distress signal according the International regulations for preventing collisions at sea. Further, a nation's flag is commonly flown inverted as a sign of protest or contempt against the country concerned. As of now, only the Philippine Flag recognizes the distress symbolism of the reverse flag.
Hanging a flag vertically 
Most flags are hung vertically by rotating the flag pole. However, some countries have specific protocols for this purpose or even have special flags for vertical hanging; usually rotating some elements of the flag — such as the coat of arms — so that they are seen in an upright position.
Examples of countries that have special protocol for vertical hanging are: Canada, Czech Republic, Greece, the Philippines, Saudi Arabia, South Africa, and the United States (reverse always showing); and the United Kingdom (obverse always showing).
Examples of countries that have special designs for vertical hanging are: Austria, Germany, Hungary, Mexico, Poland, and Slovakia (coat of arms must be rotated to normal position); Cambodia (coat of arms must be rotated and blue strips are narrowed); Dominica (coat of arms must be rotated and reverse always showing); Liechtenstein (crown must be rotated).
See also 
- Flag Day
- Flag desecration
- Flags of active autonomist and secessionist movements
- Flags of formerly independent states
- Flags of the World
- Flag protocol
- Flag terminology
- Gallery of country coats of arms
- Gallery of dependent territory flags
- Gallery of sovereign-state flags
- List of countries
- List of countries by colors of national flags
- List of countries by date of current flag adoption
- List of countries by style of national flags
- List of flags by number of colors
- National emblem
- State flag
- Timeline of national flags
- "Flags" in German, French and Italian in the online Historical Dictionary of Switzerland.
- "Guatemala". Flags of the World. 2008-07-26. Retrieved 2009-03-23. "Article 6. The genuine Remington rifles (1871) shall be shown with triangular bayonet"
- Nelson, Phil (2005-12-31), Hanging Flags Vertically, Flags of the World.
|Wikimedia Commons has media related to: Flags by country|
- Flags of the World, a massive online vexillological database on national and many other kinds of flags
- The World All Countries Flags, a website about national symbols
- World Flag Database reverse search for ID by color and layout
- Collection of Sovereign State Flags for web and software developers
-  for flag construction diagrams, flags of subnational entities, historical flags and country subdivisions