This is a slightly updated version of an older post.
So today, 3 February, is the day that Setsubun (節分) is celebrated in Japan. Setsubun is also known as the bean-throwing festival, although the literal translation of the term is something a little closer to “seasonal division”, and it is celebrated yearly on the 3rd of February as part of the haru matsuri (spring festival).
In earlier years, Setsubun was treated as something similar to a New Year celebration, and for this reason was accompanied by a ritual meant to cleanse and drive away evil and disease from the household, and bring good fortune for the new year.
The ritual was known as makemaki (豆撒き, bean thowing) and has its origins in a Chinese custom that was introduced to Japan in the eighth century. It involves throwing fortune beans – either out the door, or at a member of the family dressed as an oni (usually the head of the family) while shouting “Oni wa soto! Fuku wa uchi!” (Demons out! Luck in!)
The belief is that the beans purify the home by driving away evil spirits, while luck is brought by then eating a handful of beans – an amount equal to the number of years a person has lived.
There are several other traditions that form part of the festival, although in many cases they vary from region to region – it seems though that it is becoming less common for these rituals to be carried out at home, but Buddhist and Shinto shrines around the country hold celebrations for Setsubun, some of them even inviting celebrities to toss the beans.
Plenty of additional info at the links below.