On the 14th June 1777, the Second Continental Congress passed the so-called Flag Resolution and adopted the stars and stripes as the flag of the United States. The day is now celebrated as Flag Day, which first proclaimed by President Woodrow Wilson in 1916 although it is not an official federal holiday.
The Flag Resolution stated some general parameters for the appearance of the flag. Specifically it said that there should be thirteen alternate red and white stripes and a group of white stars against a blue background. However, it didn’t specify a precise arrangement. Consequently a range of different designs, all of which met the definition, were produced. Of these, the so-called Betsy Ross flag which has the stars arranged in a circle is probably the most famous.
The design of the flag has changed numerous times during its history to reflect the admission of more states into the Union. However, in 1818 Congress approved the Flag Act that specified there should always be thirteen stripes to represent the original thirteen colonies that broke away from British rule, and the same number of stars as states. Consequently the 50 stars on the current flag first appeared after Hawaii joined the United States in 1959.
Therefore the flag about which the national anthem, The Star Spangled Banner, was written is not the same design as the one in use today. That was instead a 15-star, 15-stripe flag flown at Fort McHenry in Baltimore Harbour during a bombardment by British Royal Navy ships in the War of 1812.