Finding out that the nuts you have in the pantry have gone stale is disappointing, especially if you found out right as you were mixing up your favorite quick bread, or worse, if you found out by biting into a rancid-tasting cookie that you just baked. Unless you regularly use nuts, chances are they will sit in the pantry for a long time before you decide to use them. The idea of throwing out an entire bag of food is unthinkable to some. However, you're better off discarding the stale nuts because the end result in baking can end up not worth eating.
Nuts are fatty and oily. While the oils make the nuts satisfying and tasty, they also make the nuts spoil rapidly. Poor storage conditions or unavoidable environmental factors like heat only speed up how fast the oils fail.
Despite folk wisdom about reheating stale nuts to make them taste a little better, don't use stale nuts in baking. They can make otherwise sweet cookies and cakes taste bitter and rancid, and trying to revive the nuts' flavor is no guarantee that, as you store the baked goods, the nuts won't return to their original stale state. Baking will cook the nuts, not place them in suspended animation. The website Ochef notes, in response to a plea from a new pastry chef about stale-tasting cookies made with fresh ingredients, that it might be possible for nuts to seem fresh before baking, but that maybe "they're already on the border," and the heat of baking is causing them to quickly turn bad. If you even suspect the nuts might be too old, you might want to get a fresh pack of nuts.
Another potential problem is mold. An obviously moldy nut isn't going to end up in your baking, but if you store them for a long time or buy already-old nuts that have mold spores in them, you risk letting the mold grow even more. If someone allergic to mold handles the nuts or eats food in which the mold survived, they could experience an allergic reaction or get sick.
Storage and Testing
Store nuts in the freezer if you don't plan to use them soon, or in the refrigerator if you plan to use them within before six months go by. Keep them in sealed containers or zippered plastic bags. The University of Missouri Extension says you can keep shelled nuts at room temperature, if you keep them cool and dry, for up to four months. Use any shelled nuts that you store at room temperature within a week or so. Once you are ready to use the nuts, taste them before you throw them into a bowl of batter. Unless you picked them yourself fresh off the tree, you really don't know how old they are, and you want to ensure they haven't gone bad in the meantime.