The final vote for independence was taken in the Continental Congress on July 2, 1776. Twelve of the thirteen colonies voted for it. One (New York) didn’t vote at all, because the delegates hadn’t yet been authorized by their constituents to do so (but soon thereafter, they received authorization and gave their vote for independence).
John Adams, one of the strongest supporters of independence, wrote to his wife:
The Second Day of July 1776, will be the most memorable Epocha, in the History of America.—I am apt to believe that it will be celebrated, by succeeding Generations, as the great anniversary Festival. It ought to be commemorated, as the Day of Deliverance by solemn Acts of Devotion to God Almighty. It ought to be solemnized with Pomp and Parade, with Shews, Games, Sports, Guns, Bells, Bonfires and Illuminations from one End of this Continent to the other from this Time forward forever more.
So why do we celebrate Independence Day on the 4th instead of the 2nd? Because that’s the date on the Declaration of Independence. They voted for independence on the 2nd, but then they debated on what the declaration should say, and they didn’t finish it until the 4th.
Of course, voting for independence didn’t actually make them independent. They still had a war to win and a country to establish. John Adams understood this well:
You will think me transported with Enthusiasm but I am not.—I am well aware of the Toil and Blood and Treasure, that it will cost Us to maintain this Declaration, and support and defend these States.—Yet through all the Gloom I can see the Rays of ravishing Light and Glory. I can see that the End is more than worth all the Means.
It took six and a half more years of “Toil and Blood and Treasure” to win the war, and decades after that to firmly establish the United States as an independent nation. Do you think it was “more than worth” it?
Note that Adams said that this “Day of Deliverance” should be commemorated not only with “Pomp and Parade,” but with “solemn Acts of Devotion to God Almighty”. We usually do pretty well on the former, but I think we could focus a bit more on the latter.