(FOX40.COM) — Sacramento is one of the best cities in the country for spooky season. 

California’s capital city was ranked the 18th best city to celebrate Halloween, according to a report from personal fiance website WalletHub. 

Sacramento was ranked behind other California cities Los Angeles (No. 3), Anaheim (No. 6), San Diego (No. 7), Santa Ana (No. 12), San Francisco (No. 13), San Jose (No. 14) and Chula Vista (No. 16). Long Beach (No. 20) was another California city to make the top 20. 

To determine the best Halloween cities in the U.S., WalletHub compared 100 of the most populated U.S. cities across three key dimensions: trick-or-treater friendliness, Halloween fun, and Halloween weather. 

WalletHub also used 20 metrics on a 100-point scale representing the most favorable conditions for a Halloween celebration. The metrics include costume stores per capita, potential of trick-or-treaters, trick or treat shops, crime rate, candy and chocolate stores per capita and weather forecast. 

Halloween Weather

Sacramento took first place for Halloween weather, beating out Philadphia, Boise, Idaho, New York City and Fremont. 

For Halloween weather, the metrics that measured were comparing Halloween temperature  average temperature and forecasted Halloween precipitation.

The metric for Halloween temperature and average temperature measures the difference between the average forecast for Halloween and the average normal temperature for this time period. 

Halloween Fun

The capital city also ranked 18th for Halloween fun, determined by the following metrics: 

•Google searh index for “Halloween parties” 

•Halloween costume stores per capita

•Halloween party supply stores per capita

•Candy and chocolate stores per capita

•Haunted houses per capita

•Pumpkin patches per capita

•Movie theaters per capita

•Average price per movie ticket

•Bars and dance clubs per capita

•Number of amusement parks

Trick-or-treater friendliness

Sacramento ranked 48th in trick-or-treater friendliness after the following factors were meastured: 

•Share of potential trick-or-treaters

•Share of potential trick-or-treat stops

•Population density

•Walk score

•Crime rate

•Car crash related pedestrian fatality rate

•Perception of safety