10/16/2012 12:55 pm ET Updated Oct 17, 2012

Trick-Or-Treating: Best Cities Ranking Puts San Francisco At Number One Spot

Sorry, Baltimore kids. It looks like trick-or-treaters in San Francisco, Calif. have the upper hand this year when it comes to Halloween.

For the fourth year in a row, the real estate company Zillow has ranked the top 20 cities for trick-or-treating. This year, San Francisco topped the list.

Despite the common perception that wealthy cities are the best for trick-or-treating, Zillow determined the list based on four factors: home value, population density, walkability of the neighborhood and crime data. Given how much money we're expected to spend on Halloween this year, it may be worth strategizing a bit to ensure you're getting the best bang for your buck while hunting for candy.

This year, it is estimated that the average American will spend $24 on Halloween candy, according to Foodbeast. Men will outspend women by an average of $4.58 and the age group that will spend the most on candy is 25-to-34-year-olds.

Last year, Americans spent a total of $2.3 billion on Halloween, a record high, according tothe San Francisco Chronicle.

Where does your city rank on the trick or treat scale? Check out the list below.

Best Cities To Trick Or Treat