United States federal law dictates a detailed set of rules for American citizens to uphold during the playing of the national anthem. Though perceived as customary in origin, these laws command specific behavior for both civilians and military personnel.
National Anthem Etiquette
During any rendition of "The Star-Spangled Banner," all persons are required to stand and face the American flag, if it's displayed. Civilians place the palm of their right hand across their chest, over their heart. Individuals should remove any headdress with their right hand and hold it at the left shoulder. Members of the military in uniform must face and salute the flag. Additional laws and observances related to the national anthem are found in Title 36 of the United States Code.