fireworks
Fireworks in Washington, DC on July 4, 2014 to commemorate the 239th anniversary of the United States' independence. Chip Somodevilla/Getty Images

How and where to spend a holiday is a frequent puzzle for many. Luckily, WalletHub published a study this week of the best and worst places to celebrate the Fourth of July, as the holiday dedicated to American independence is next Tuesday.

WalletHub compiled their list, published Monday ahead of the holiday weekend, by comparing 100 of the largest U.S. cities. American households were predicted to spend $7.15 billion on Fourth of July food this year, according to the National Retail Federation. This number increased from $6.8 billion, the amount Americans spent on food in 2016.

Read: 4th Of July Trivia Facts 2016: 15 Fun Things To Know About Independence Day

WalletHub decided the overall rank of the cities by adding each city’s scores in each of these categories: "Fourth of July Celebrations," "Affordability," "Attractions & Activities," "Safety & Accessibility" and "Fourth of July Weather."

WalletHub listed the top five places in which to celebrate the July 4 as follows:

1. Atlanta, Georgia

2. San Francisco, California

3. Buffalo, New York

4. Washington, DC

5. San Diego, California

Although Atlanta ranked number one in none of the categories listed, it landed the number one spot overall because of its numerous Fourth of July activities, attractions and a relatively affordable score: 34/100. And despite San Francisco's affordability score listed as 64/100, it nabbed the number two spot because of its solid celebrations, high attractions rank and good weather predictions.

Buffalo, New York came in at number three overall, ranking number one in celebrations. Washington, DC ranked fourth on the list because of its high rankings in both the celebration and safety categories. San Diego, California scored the fifth spot on the list because of its predicted good weather.

WalletHub placed these cities as the last five on their list:

96. San Bernardino, California

97. Lubbock, Texas

98. Gilbert, Arizona

99. Jersey City, New Jersey

100. Newark, New Jersey

San Bernardino, California, scored the 96th spot on the list because of its low scores in affordability, attractions and safety. Lubbock, Texas, at number 97, obtained low scores in both the safety and weather categories. Gilbert, Arizona ranked 98th on the list because of its low score in weather predictions and attractions, despite its status as the city with the lowest average beer and wine prices.

Read: How To Read Declaration Of Independence Full Text On The Fourth Of July

Jersey City, New Jersey ranked 99th on the list due to its low scores in celebrations and weather predictions. Although it ranked number one in safety & accessibility, boasting the fewest DUI-related fatalities per capita, that was not enough to boost its position on the list. Newark, New Jersey scored the last spot on the list because it had the worst rank in celebrations, as well as low scores in affordability and weather predictions.