You have to be 18 or older and you have to be legally registered to vote. In 1971, the Twenty-sixth Amendment set the legal voting age at 18 for both US federal and state elections.
In the United States nineteen states permit 17-year-olds to vote in primary elections and caucuses if they will be 18 years of age, by election day. An amendment to the state constitution is being considered in the Illinois legislature that would lower its voting age to 17 for non-federal elections, though states can set their voting age to lower than eighteen for federal elections as well. Because it only applies to state elections, seventeen-year-olds would not be able to vote in primaries and general elections for representatives, senators, and President of the United States even if the amendment passes the legislature and referendum