From the Library of Congress:
On April 12, 1818, a new flag flew over the U.S. Capitol for the first time. The flag’s thirteen stripes represented the original colonies, and its twenty stars symbolized the number of states in the Union.
The first national flag, emblazoned with thirteen stripes and thirteen stars, was modified in 1795 when Kentucky and Vermont entered the Union. A flag with fifteen stars and fifteen stripes was used during the war of 1812. It was the fifteen star and fifteen stripe flag which flew over Fort McHenry during the War of 1812 inspired Francis Scott Key to write “The Star Spangled Banner.”
Continued expansion of the Union meant Congress soon again faced the prospect of adding to the number of the flag’s stars and stripes. Thus, in 1818, Congress settled on the expediency of altering the flag according to its present formula whereby stripes represent the original thirteen colonies, and stars are coincident with the number of states in the Union. The Independence Day following the admission of a State was set as the occasion for adding new stars to the flag. With the admission of Hawaii, the fiftieth star was added to the flag on July 4, 1960.
Photo is of the Star Spangled Banner.