Everyone enjoys the October holiday when you dress up in costumes and adorn your home with spiders. But why and how did October 31st come to be the year’s spookiest day?

Samhain, a Celtic New Year’s Day that fell on November 1, is considered to have existed more than 2,000 years ago, giving Halloween its history. The previous night, when the line between the worlds of the living and the dead was tenuous, it was believed that demons, fairies, and ghosts of the dead roamed the Earth. The Celts lit bonfires and donned masks on the eve of Samhain. The Catholic Church then changed Samhain’s name to All Saints’ Day, also known as All Hallows’ Day, more than a thousand years ago. All Hallows’ Eve, which later became known as Halloween, was the name given to the previous evening, October 31. The finest part of Halloween—free candy—dates back to Samhain. People would leave food out for any ghosts that might be skulking around that night. But how did those Celtic customs change to allow kids to trick-or-treat while dressed up for fun and treats rather than protection against ghosts? Trick-or-treating might be a relatively modern ritual that, interestingly, may have been influenced by a Christmas habit called belsnickling, according to one author. As a sort of barter for food and drink, groups of costumed performers would visit homes to perform small tricks in the eastern United States and Canada.

Halloween is a fantastic time to scare one another. Even a little bit, as the days become shorter and the nights grow longer.