A flag is a piece of fabric (most often rectangular) with distinctive colours and design, often flown from a pole and used for symbolic, signaling, or decorative purposes. The term flag is also used to refer to the graphic design employed on such pieces of fabric. The study of flags is known as "vexillology" from the Latin vexillum, meaning "flag" or "banner".
The first flags were used to aid military coordination on the battlefield, and flags have since evolved into a common tool for basic signaling and identification, especially in environments where communication is challenging (such as maritime environments where semaphore is used). The national flag is a common patriotic symbol of a country, and many national or other flags may be assigned to flag families based off similarities in their structure that demonstrate a shared history, culture, or influence. Flags are also used in messages, advertising, or for other decorative purposes.