A chef weighs in on whether or not your pantry staples are still good.

A fully-stocked pantry is a home cook's best friend. It will save trips to the store, make meal planning easier, and even keep your kitchen free of clutter. But sometimes the items in our pantries get neglected and unused for long stretches of time. If you've ever given the side eye to a bag of flour that hasn't been touched in a couple of years, you probably found yourself wondering if non-perishables really are, well, non-perishable. The answer is a bit complicated. Although most pantry staples and shelf-stable goods are basically safe to eat forever, their quality, flavor, and nutritional value often degrade over time. With this information in mind, we asked Chef Lane Richardson of the acclaimed farm-to-table restaurant, Dovetail, in Macon, Georgia, to weigh in on how often you need to replace your pantry staples before they begin to deteriorate.

When it comes to flours, all-purpose flour lasts longer than whole grain flours that contain wheat germ and similar ingredients. According to Lane, for the best results, you should use or replace your flour within a few months of the expiration date. He says after that, it isn't dangerous to eat but he also cautions that "your baked goods won't taste great." If you're unsure of whether or not your flour is past its prime, give it a good sniff. If you catch musty odors, it's time to replace it.

Dried Beans
While dried beans will last indefinitely, Lane cautions that they'll begin to lose their nutritional content a couple of years past their expiration date. It's best to make a big pot of soup and use up those dried beans within about a year or so of the expiration date.

It's usually pretty easy to tell if your nuts have gone bad, because they'll begin to soften and lose their crunch. Additionally, Lane says the oils will eventually turn rancid. Most nuts are at their peak freshness for about three to six months after purchase. Pro tip: Extend the shelf life of your nuts by storing them in the freezer. "They aren't as good for snacking, but they're still good for pies and cookies," he says.

Good news! White granulated sugar will keep indefinitely, especially if you store it in an airtight container. Brown sugar will last indefinitely, too, but the moisture content from the molasses will eventually evaporate and turn hard. Even so, it should still be usable.

Dried Spices
Spices will begin to degrade and lose flavor over time. If you can't remember when you purchased a spice, it's probably time to replace it. Another general guideline is that you should replace ground spices within a year of purchase and whole spices within two or three years. "We use spices to add flavoring, so you want to make sure you're using them at peak quality," says Lane.

Baking Powder and Baking Soda
Baking soda and baking powder are ingredients used to cause chemical reactions in baking. The date on the box isn't necessarily a hard deadline, but you don't want to wait too long to replace them or they won't work as well. Generally speaking, your best bet is to replace both within about six months of the expiration date.

Dried white rice can last for several years past the "sell-by" date." Lane says that brown rice, on the other hand, won't last as long. It will have to be used within about six months of the expiration date. He says, "if you're worried your rice is nearing the end of its shelf-life, you can cook it and freeze it and it'll last an extra six to eight months."

Dried Pasta
Dried pasta is a good thing to buy when you see it on sale, because it's another staple that will last a very long time. However, Lane cautions that after a couple of years, it won't taste as good. To be safe, use dried pasta within one to two years of the expiration date.

Cooking Sherry
Cooking sherry has a very short shelf life. Unopened, it will last two to three months beyond the expiration date, but opened, it needs to be stored in the refrigerator and used within two to three weeks.

Olive Oil
"Olive oil can last up to two years as long as it's sealed tightly and kept out of the sunlight," says Lane. "However, I think a better way to go about buying olive oil is to buy smaller containers of it more often; that way you won't need to worry about it spoiling. It is fat, so it will eventually go rancid, but a smell or taste test is an easy way to tell if it's still good."