A flag officer is a commissioned officer in a nation's armed forces senior enough to be entitled to fly a flag to mark the position from which the officer exercises command.
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).
A flag officer sometimes is a junior officer, called a flag lieutenant or flag adjutant, attached as a personal adjutant or aide-de-camp.
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.