The word Halloween was first used in the 16th century and represents a Scottish variant of the fuller All Hallows' Eve ('evening'), that is, the night before All Hallows' Day. Although the phrase All Hallows' is found in Old English (ealra hálgena mæssedæg, mass-day of all saints), All Hallows' Eve is itself not seen until 1556.

Halloween or Hallowe'en (a contraction of "All Hallows' Evening"), also known as All Hallows' Eve, is a yearly celebration observed in a number of countries on October 31, the eve of the Western Christian feast of All Hallows (or All Saints) and the day initiating the triduum of Hallowmas.

According to many scholars, All Hallows' Eve is a Christianised feast originally influenced by western European harvest festivals, and festivals of the dead with possible pagan roots, particularly the Celtic Samhain. Other scholars maintain that it originated independently of Samhain and has solely Christian roots.

Though the origin of the word Halloween is Christian, the holiday is commonly thought to have pagan roots. Historian Nicholas Rogers, exploring the origins of Halloween, notes that while "some folklorists have detected its origins in the Roman feast of Pomona, the goddess of fruits and seeds, or in the festival of the dead called Parentalia, it is more typically linked to the Celtic festival of Samhain", which comes from the Old Irish for "summer's end". Samhain (pronounced SAH-win or SOW-in) was the first and most important of the four quarter days in the medieval Gaelic (Irish, Scottish and Manx) calendar. It was held on or about October 31 – November 1 and kindred festivals were held at the same time of year in other Celtic lands; for example the BrythonicCalan Gaeaf (in Wales), Kalan Gwav (in Cornwall) and Kalan Goañv (in Brittany). Samhain is mentioned in some of the earliest Irish literature and many important events in Irish mythology happen or begin on Samhain. It marked the end of the harvest season and the beginning of winter or the 'darker half' of the year. This was a time for stock-taking and preparing for the cold winter ahead; cattle were brought back down from the summer pastures and livestock were slaughtered. In much of the Gaelic world, bonfires were lit and there were rituals involving them. Some of these rituals hint that they may once have involved human sacrifice. Divination games or rituals were also done at Samhain.

Samhain (like Beltane) was seen as a time when the 'door' to the Otherworld opened enough for the souls of the dead, and other beings such as fairies, to come into our world. The souls of the dead were said to revisit their homes on Samhain. Feasts were had, at which the souls of dead kin were beckoned to attend and a place set at the table for them. Lewis Spence described it as a "feast of the dead" and "festival of the fairies". However, harmful spirits and fairies were also thought to be active at Samhain. People took steps to allay or ward-off these harmful spirits/fairies, which is thought to have influenced today's Halloween customs. Before the 20th century, wearing costumes at Samhain was done in parts of Ireland, Mann, the Scottish Highlands and islands, and Wales. Wearing costumes may have originated as a means of disguising oneself from these harmful spirits/fairies, although some suggest that the custom comes from a Christian or Christianized belief. In Ireland, people went about before nightfall collecting for Samhain feasts and sometimes wore costumes while doing so. In the 19th century on Ireland's southern coast, a man dressed as a white mare would lead youths door-to-door collecting food; by giving them food, the household could expect good fortune from the 'Muck Olla'. In Moray during the 18th century, boys called at each house in their village asking for fuel for the Samhain bonfire. The modern custom of trick-or-treating may have come from these practices. Alternatively, it may come from the Christian custom of souling.

Making jack-o'-lanterns at Halloween may also have sprung from Samhain and Celtic beliefs. Turnip lanterns, sometimes with faces carved into them, were made on Samhain in the 19th century in parts of Ireland and the Scottish Highlands. As well as being used to light one's way while outside on Samhain night, they may also have been used to represent the spirits/fairies and/or to protect oneself and one's home from them. Another legend is that a trickster named Jack decided one day to trick the Devil. He trapped the Devil in a Pumpkin and paraded him around town. Eventually, Jack let the Devil out and the Devil put a curse on Jack and forever made him a spirit in hell. On Halloween, Jack is released to terrorize the country all night. To protect themselves, the Irish would place a Pumpkin with a face, outside to scare Jack into believing it was the Devil.

A short rundown of Halloween from National Geographic

Halloween is also thought to have been influenced by the Christian holy days of All Saints' Day (also known as All Hallows, Hallowmas or Hallowtide) on November 1 and All Souls' Day on November 2. They are a time for honoring the saints and praying for the recently departed who had yet to reach Heaven. All Saints was introduced in the year 609, but was originally celebrated on May 13. In 835, it was switched to November 1 (the same date as Samhain) at the behest of Pope Gregory IV. Some have suggested this was due to Celtic influence, while others suggest it was a Germanic idea.

By the end of the 12th century they had become holy days of obligation across Europe and involved such traditions as ringing bells for the souls in purgatory. "Souling", the custom of baking and sharing soul cakes for "all crysten christened souls", has been suggested as the origin of trick-or-treating. Groups of poor people, often children, would go door-to-door on All Saints/All Souls collecting soul cakes, originally as a means of praying for souls in purgatory. Similar practices for the souls of the dead were found as far south as Italy. Shakespeare mentions the practice in his comedy The Two Gentlemen of Verona (1593), when Speed accuses his master of "puling [whimpering or whining] like a beggar at Hallowmas." The custom of wearing costumes has been linked to All Saints/All Souls by Prince Sorie Conteh, who wrote: "It was traditionally believed that the souls of the departed wandered the earth until All Saints' Day, and All Hallows' Eve provided one last chance for the dead to gain vengeance on their enemies before moving to the next world. In order to avoid being recognised by any soul that might be seeking such vengeance, people would don masks or costumes to disguise their identities". In Halloween: From Pagan Ritual to Party Night, Nicholas Rogers explained Halloween jack-o'-lanterns as originally being representations of souls in purgatory. In Brittany children would set candles in skulls in graveyards.