The several branches of the United States Armed Forces are represented by flags. Within the U.S. military, various flags fly on various occasions, and on various ships, bases, camps, and military academies.
In general, the order of precedence (from viewer's left to right) when displaying flags together in a military context is to display the U.S. national flag (also known as the "colors" or "national colors"), followed by the flags of the U.S. Army, U.S. Marine Corps, U.S. Navy, U.S. Air Force, U.S. Space Force, and U.S. Coast Guard. If the U.S. Coast Guard is transferred to the Department of the Navy, the U.S. Coast Guard flag would precede the U.S. Air Force flag.
Many maritime flags have been used in the United States.
All maritime vessels and naval warships belonging to the United States (with a few exceptions such as U.S. Coast Guard vessels) fly the ensign of the United States, which is identical to the national flag of the United States (though originally was a design similar to the Grand Union Flag). All documented U.S. vessels, and all U.S. vessels in international or foreign waters, are required to display this ensign between 08:00 and sunset. Conversely, vessels of the U.S. Coast Guard display a unique ensign as a demonstration of its authority to stop, board, search, and conduct arrests and seizures aboard vessels subject to United States jurisdiction. Historically, the ensign displayed has changed as the flag of the United States has changed. Similarly, vessels of the Continental Navy flew many varied ensigns due to a vague standard set by the Continental Congress, the arrangement of stars and pattern of stripes being left to the commander's interpretations.
Vessels of the U.S. Navy, Coast Guard, Military Sealift Command, and National Oceanic and Atmospheric Administration display the jack of the United States from the jackstaff. Originally the First Navy Jack was displayed, a design containing the thirteen red and white stripes; while some maintain that it was superimposed by an uncoiled rattlesnake and the motto "Dont tread on me" [sic], reminiscent of the Gadsden flag. It was later changed to a blue canton with white stars, the "Union Jack", and updated as each state entered the Union. However, all warships were directed to fly the First Navy Jack, including the disputed rattlesnake and motto, since the duration of the War on Terror in 2002. On February 21, 2019, the Chief of Naval Operations directed that U.S. Navy warships fly the U.S. jack again beginning on June 4, 2019.
A Commissioning or Masthead pennant is flown from the masthead and represents the commission of the captain of the ship (and thus of the ship itself). Additionally, a Church pennant may be flown during religious services. This pennant, white with a blue cross (or blue tablets and Star of David for Jewish services), is the only flags authorized to be flown above the national ensign, and only when at sea. In addition, hospital ships display the Red Cross.
Ships and units ashore may also fly burgees displaying unit citations. Flags can also be used for signaling.
Officers with certain offices or billets, as well as all generals and admirals, have a personal flag assigned to represent their authority and/or command; thus why they are often referred to as "flag officers". Ashore, they are usually displayed within the owner's office or raised on a secondary flagstaff near the unit colors; while they are flown aboard ship according to rank. The appearance consists of a number of stars equal to the officer's rank insignia, the colors determined by service: red with white stars for the Army and Marine Corps, blue with white stars for Naval commanders and Air Force. Certain staff and non-line officers have unique colors: white with blue stars for non-command Navy admirals, while Army chaplains and medical generals use ecclesiastical purple and maroon backgrounds, respectively.
Unique flags are given to the President (due to his position as Commander-in-Chief), Vice President, Secretary of Defense, Deputy Secretary of Defense, Under Secretaries of Defense, and Assistant Secretaries of Defense, each of the Secretaries of the Military Departments (Secretary of the Army, Secretary of the Navy, Secretary of the Air Force), Under Secretaries of the Military Departments (Under Secretary of the Army, Under Secretary of the Navy, Under Secretary of the Air Force), and Assistant Secretaries of the Military Departments (Assistant Secretary of the Army, Assistant Secretary of the Navy, Assistant Secretary of the Air Force), the Chairman of the Joint Chiefs of Staff, Vice Chairman of the Joint Chiefs of Staff and Senior Enlisted Advisor of the Joint Chiefs of Staff, and the chief of the Military Services (Chief of Staff of the Army, Commandant of the Marine Corps, Chief of Naval Operations, Chief of Staff of the Air Force, Chief of Space Operations, and Commandant of the Coast Guard). An admiral, acting commodore, or Convoy Commodore aboard a ship each may fly a flag from their flagship.
In addition, the Navy will display the flag of the Secretary of State when he or she is embarked as the representative of the United States. Other diplomatic personnel are also afforded a consular flag when embarked. The Coast Guard, being part of the Department of Homeland Security, will utilize the Secretary's flag much like the Navy will utilize the SecDef's.
Many other flags are traditionally associated with the military.
Not having made an official design until 1777, numerous distinct flags were carried into battle by American forces. Even after, the vague wording of the Flag Resolution of 1777 led to many designs.