SAN DIEGO — It’s October and that means spooky season is upon us.

Trick-or-treating is a staple during Halloween, so knowing where to participate in the activity safely is very important for parents.

Carlsbad was recently ranked the 18th safest city in the nation for trick-or-treating because of its low crime rate, high number of law enforcement employees and safe streets for pedestrians, according to a study by ChamberofCommerce.org.

The study used five key metrics: pedestrian fatalities, violent crime, property crime, the number of registered sex offenders and number of law enforcement employees. Each metric was calculated per 10,000 residents.

For crimes, 18.3 residents were involved in violent crime incidents while 180.2 in property crime incidents in Carlsbad, the research shows. There were 3.4 residents for the number of registered sex offenders.

Law enforcement employees make up 15.5 of residents while the average annual pedestrian fatalities was 0.05.

Four other cities in California also ranked within the top 25 safest, including Irvine (No. 10), Glendale (No. 12), Murrieta (No. 21) and Sunnyvale (No. 22).