A flag is a piece of fabric with a distinctive design that is usually rectangular and used as a symbol, as a signaling device, or decoration. The term flag is also used to refer to the graphic design employed by a flag, or to its depiction in another medium.
The first flags were used to assist military coordination on battlefields, and flags have since evolved into a general tool for rudimentary signalling and identification, especially in environments where communication is similarly challenging (such as the maritime environment where semaphore is used). National flags are potent patriotic symbols with varied wide-ranging interpretations, often including strong military associations due to their original and ongoing military uses. Flags are also used in messaging, advertising, or for other decorative purposes. The study of flags is known as vexillology, from the Latin vexillum meaning flag or banner.
In antiquity, field signs or standards were used in warfare that can be categorized as vexilloid or “flag-like”. Examples include the Achaemenid battle standard Derafsh Kaviani, and the standards of the Roman legions such as the eagle of Augustus Caesar’s Xth legion, or the dragon standard of the Sarmatians; the latter was let fly freely in the wind, carried by a horseman, but judging from depictions it was more similar to an elongated dragon kite than to a simple flag.
During the High Middle Ages flags came to be used primarily as a heraldic device in battle, allowing more easily to identify a knight than only from the heraldic device painted on the shield. Already during the high medieval period, and increasingly during the Late Middle Ages, city states and communes such as those of the Old Swiss Confederacy also began to use flags as field signs. Regimental flags for individual units became commonplace during the Early Modern period.
During the peak of the age of sail, beginning in the early 17th century, it has been customary (and later a legal requirement) for ships to carry flags designating their nationality; these flags eventually evolved into the national flags and maritime flags of today. Flags also became the preferred means of communications at sea, resulting in various systems of flag signals; see, International maritime signal flags.
Use of flags outside of military or naval context begins only with the rise of nationalist sentiment by the end of the 18th century; the earliest national flags date to that period, and during the 19th century it became common for every sovereign state to introduce a national flag.