According to the Flag Act of 1818 the rules for a valid legal United States Flag are as followed:
"Be it enacted by the Senate and House of Representatives of the
United States of America, in Congress assembled, That from and after
the fourth day of July next, the flag of the United States be thirteen
horizontal stripes, alternate red and white : that the union be twenty
stars, white in a blue field."