With sell-by dates and expiration dates displayed on packaging, it’s easy to assume that all foods—even shelf-stable pantry items—eventually expire. Not so with sugar! According to Domino Sugar, “Sugar… has an indefinite shelf life because it does not support microbial growth.”
You heard that right: sugar never goes bad. That being said, the quality of your sugar over time will depend on how you store it, and most manufacturers recommend using it within 2 years for the best quality.
Why Sugar Lasts So Long
It turns out that, like salt, sugar prevents microbial growth. That’s part of the reason jams and jellies have such high sugar content; it’s an effective way to preserve the fruit and keep it safe to eat. As Mickey Parish, chair of the Nutrition and Food Science Department at the University of Maryland writes in Scientific American, sugar prevents bacteria from growing because of osmosis, or dehydration.
That tendency for sugar to dehydrate means that there just isn’t enough water for most microbial colonies to thrive in high-sugar environments—like the bag of granulated sugar sitting on your pantry shelf.
How to Store Sugar
While it won’t go bad, the quality of sugar can still deteriorate if you don’t store it properly. Sugar absorbs smells and moisture easily and is susceptible to bugs like ants. That’s why you should store sugar in an airtight and moisture-proof container on a cool, dark shelf in your kitchen.
Avoid storing sugar in the fridge, since it is a high moisture environment, and keep it away from smelly foods. It’s especially important to keep brown sugar in an airtight container to retain its moisture and keep it from clumping. While it won’t spoil, brown sugar is best used within 6 months since it tends to harden so easily.
How to Fix Lumpy Sugar
If you see lumps in your white sugar, that doesn’t mean the sugar has gone bad. It just means that it’s been exposed to a bit of moisture. All you have to do is break up the lumps before using. If the sugar is especially solid, add it to a food processor and pulse to break up the crystals.
To revive hard brown sugar, add a couple of slices of white bread or a couple of large marshmallows to the container and seal. Let sit for a couple of days, remove, and then break up the sugar with a fork.
A version of this article originally appeared on MyRecipes.com