Coffee aficionados have strong opinions about every aspect of the product, including how to store it. You may have heard that sticking ground coffee or whole beans in the freezer is the best way to preserve the coffee’s flavor. Though it is true that coffee goes stale quickly when not stored properly, freezing it can sometimes do more harm than good.

According to the National Coffee Association, the best thing you can do for your coffee is store it in an airtight container. Ground coffee loses freshness faster than whole beans because it has more surface area that's exposed to oxygen. Whole beans also start to lose freshness almost as soon as they're done roasting, so they benefit from proper storage as well.

Coffee should be kept in an opaque container to protect it from light. Find a cool spot in your kitchen to store it—a pantry that's too close to the stove or a countertop that gets a lot of sunlight may be too warm. Coffee grounds are often sold in tins that aren't built for long-term storage, so transfer the coffee to a canister with an air-tight lid once you bring it home. If you have a bag of beans or grounds and no container to put them in, secure the bag with a rubber band and store it in a resealable plastic bag.

In many cases, you should avoid freezing your coffee if you want to prolong its shelf-life. When bags or canisters contain air—which is hard to avoid—this can lead to freezer-burnt coffee. Moisture is another enemy of fresh coffee, and removing a container from your freezer and putting it back in every morning promotes condensation.

Freezing your coffee can keep it fresh for up to a month if you take the right steps. Divide the product into individually-portioned bags before putting it in the freezer—that way you won't have to remove the coffee until it's read to thaw. When you seal the coffee bags, make sure to get them as airtight as possible. Here are more tips for brewing better coffee at home.