Key penned “The Star-Spangled Banner” on September 14, 1814, but the music for it had been written in 1777 by the Englishman John Stafford Smith. The music was a setting for another poem, “To Anacreon in Heaven,” which was a favorite of a London drinking club called the Anacreontic Society. Smith’s original is a celebration of the pleasures of music, love, and wine. The melody soon became popular in the United States—both before and after Key made up the new words for it. In fact, by 1820, at least 84 different poems were being sung to the “Anacreontic melody.”
“The Star-Spangled Banner” instantly became a popular patriotic air and was the informal anthem of the Union Army during the Civil War. The U.S. Army adopted the song officially during World War 1, but it did not become truly the national anthem until March 3, 1931, when President Herbert Hoover signed it into law.