The Continental Congress voted for American independence on July 2, 1776.
The vote approved the Lee Resolution, which declared that the United Colonies were free and independent states. The resolution had been introduced by Richard Henry Lee of Virginia and represented the formal decision to separate from Great Britain.
July 4 is celebrated because Congress adopted and proclaimed the Declaration of Independence on that date. The Declaration explained the reasons for separation, while the July 2 vote was the decisive political action authorizing independence.
These two dates are often confused because modern Independence Day observances focus on July 4. John Adams even predicted that July 2 would become the celebrated anniversary, but July 4 ultimately became the traditional national holiday.