In its early form, the candy cane began as a simple white stick of sugar for children to eat - there was no "cane" shape or stripes to speak of. While it is uncertain where the first canes originated, it is clear that by the mid-17th century, if not earlier, its use had already become widespread across Europe. These sticks were made by confectioners who had to pull, cut, twist, and (in later years) bend the sugar sticks by hand, making it a time-intensive process. Candy cane production had to be done locally, since they were easily damaged and vulnerable to moisture, and the labour required, and difficulty of storage, combined to make these candies relatively hard to get, although popular.
The distinctive "hook" shape associated with candy canes is traditionally credited to a choirmaster at Cologne Cathedral in Germany, who, legend has it, in 1670 bent straight candy sticks into canes to represent a shepherd's crook, and gave them to children at church services. The shepherd's staff is often used in Christianity as a metaphor for The Good Shepherd Jesus Christ. It is also possible that, as people decorated their Yule trees with food, the bent candy cane was invented as a functional solution.
In Europe, candy canes were used to decorate Yule trees along with other items of food. In North America, the first documented example of the use of candy canes to celebrate Christmas occurred in 1847, when a German-Swedish immigrant by the name of August Imgard hung the candy canes from the branches of a Christmas tree. Christmas cards from the following decades show Christmas trees decorated with candy canes, first white canes, then striped ones in the 20th century. This then spread to the rest of the continent, where it continues to remain a popular Christmas tradition.
The stripes are made similar in fashion to a barber's pole, with the red stripes twisting around the white stick of sugar. These signature stripes did not become part of the candy cane until the 20th century. It is uncertain who first started using the stripes, but evidence of their use only appears after the turn of the century. At around this time, candy makers began using peppermint as a flavour. One of the first documented candy canes in this form is the polkagris, invented in 1859.
Bobs Candies was the first company to successfully mass-produce and distribute candy canes while preserving their freshness. Lt. Bob McCormack began making candy canes as special Christmas treats in the 1920s. That decade also saw the company's use of cellophane as a wrapping to keep moisture from damaging the candies, and by the 1950s, they were using a candy cane machine invented by his brother-in-law Gregory Keller to mass-produce them. These two inventions made it feasible to mass produce, ship, and distribute candy canes. The following years saw further refinements in packaging and design to protect the candies from being broken, making it more practical to store them and ship them for longer periods of time.
There is a modern allegorical tradition that reinterprets the candy cane's shape as a "J", standing for Jesus Christ or the right side up standing for the shepherds that came to visit baby Jesus. The stripes are said to represent his sacrifice, with the red being blood, and the white being purity. However, no historical information to support any claim that the cane was originally made with this allegory in mind has been produced, so it is regarded as an urban legend.