The term is used differently in different countries:
The generic title of flag officer is used in several modern navies and coast guards to denote those who hold the rank of rear admiral (or its equivalent) and above, also called "flag ranks"; in some navies, this also includes the rank of commodore. Flag officer corresponds to the generic terms general officer (used by land and some air forces to describe all grades of generals) and air officer (used by other air forces to describe all grades of air marshals and air commodores).
In the Canadian Forces, a flag officer (French: officier général, "general officer") is an admiral, vice-admiral, rear-admiral, or commodore, the naval equivalent of a general officer of the army or air force. It is a somewhat counterintuitive usage of the term, as only flag officers in command of commands or formations actually have their own flags (technically a commodore has only a broad pennant, not a flag), and army and air force generals in command of commands or formations also have their own flags, but are not called flag officers. Base commanders, usually full colonels, also have a pennant that flies from the mast or flagpole on the base, when resident, or on vehicles that carry them.
A flag officer's rank is denoted by a wide strip of gold braid on the cuff of the service dress tunic; one to four gold maple leaves over a crossed sword and baton, all beneath a royal crown, on epaulettes and shoulder boards; and two rows of gold oak leaves on the peak of the service cap. Since the unification of the Canadian Forces in 1968, a flag officer's dress tunic had a single broad stripe on the sleeve and epaulettes. On May 5, 2010, however, the naval uniform dark dress tunic was adjusted--exterior epaulettes were removed, reverting to the sleeve ring and executive curl-rank insignia used by most navies; commodores' uniforms display a broad stripe, and each succeeding rank receives an additional sleeve ring. There are no epaulettes on the exterior of the tunic, but they are still worn on the uniform shirt underneath.
In India, it is applied to brigadiers, major generals, lieutenant generals and generals in the Army; commodores, rear admirals, vice admirals and admirals in the Navy; and air commodores, air vice marshals, air marshals and air chief marshals in the Air Force. Each of these flag officers is designated with a specific flag. India's honorary ranks (five star ranks) are field marshal in the Army, marshal of the Indian Air Force in the Air Force and admiral of the fleet in the Navy.
In the Royal Navy, there is a distinction between the "flag officer" and "officer of flag" ranks. Formerly all officers promoted to flag rank were considered to be "flag officers" and the term is still widely used to refer to any officer of flag rank. Present usage is that all rear-admirals and above are officers of flag rank, but only those officers of flag rank who are authorised to fly a flag are formally called "flag officers", and have different flags for different ranks of admiral. Of the 39 officers of flag rank in the Royal Navy in 2006, very few were "flag officers" with entitlement to fly a flag. For example, Commander-in-Chief Fleet flies an admiral's flag whether ashore or afloat and is a "flag officer"; the chief of staff (support), a rear admiral, is not entitled to fly a flag and is an "officer of flag rank" rather than a "flag officer". List of fleets and major commands of the Royal Navy lists most admirals who were "flag officers". A flag officer's junior officer is often known as "Flags".
Equivalent ranks in the British Army and Royal Marines are called general officer rather than flag officers, and those in the Royal Air Force (as well as the rank of air commodore) are called air officers, although all are entitled to fly flags of rank.
Captain was the highest rank in the United States Navy from its beginning in 1775 until 1857, when Congress created the temporary rank of Flag Officer, which gave way to Commodore and Rear Admiral in 1862. The rank of "flag officer" was bestowed on senior Navy captains who were assigned to lead a squadron of vessels in addition to command of their own ship. The 19th-century rank of "flag officer" was considered strictly temporary and became obsolete upon the creation and widespread usage of the equivalent naval rank of commodore; however, the term is still in use today, explicitly defined as an officer of the U.S. Navy or Coast Guard serving in or having the grade of admiral, vice admiral, rear admiral, or rear admiral (lower half),  equivalent to general officers of an army. In 1862 Congress authorized the use of the title "admiral".
In the United States Army, Air Force, and Marine Corps, the term "flag officer" generally is applied to all general officers authorized to fly their own command flags--i.e., brigadier general, or pay grade O-7, and above. However, as a matter of law, Title 10 of the United States Code makes a distinction between general officers and flag officers. Non-naval officers usually fly their flags from their headquarters, vessels, or vehicles, typically only for the most senior officer present. In the United States all flag and general officers must be nominated by the President and confirmed by the Senate; each subsequent promotion requires renomination and re-approval. For the Navy, each flag officer assignment is usually limited to a maximum of two years, followed by either reassignment, reassignment and promotion, or retirement.