There are two separate meanings for the term of state flag in vexillology, the flag of the government of a sovereign state and the flag of an individual subnational state.
A state flag is a variant of a national flag (or occasionally a completely different design) specifically designated and restricted by law or custom (theoretically or actually) to use by a country's government or its agencies. For this reason they are sometimes referred to as government flags. In many countries the state flag and the civil flag (as flown by the general public) are identical, but in other countries, notably those in Latin America, central Europe, and Scandinavia, the state flag is a more complex version of the national flag, often featuring the national coat of arms or some other emblem as part of the design. Scandinavian countries also use swallowtailed state flags, to further differentiate them from civil flags.
In addition, some countries have state ensigns, separate flags for use by non-military government ships such as guard vessels. For example, government ships in the United Kingdom fly the blue ensign.
State flags should not be confused with the national flag as used by military organisations; these are referred to as war flags and naval ensigns.
In Australia, Brazil, the United States, and some other federal countries, the term state flag can have a different usage, as it frequently refers to an official flag of any of the individual states or territorial sub-divisions that make up the nation.