Everyone starts their mornings differently, but one common thread amongst the masses tends to be the consumption of coffee, albeit in many different forms—instant, pre-ground, K-Cups, Nespresso, and so on. And I'm sure that we all have our own preferred methods, as well.
As for my husband and me, we prefer to buy our coffee beans whole instead of pre-ground; the flavor and aroma are more potent when they are freshly-ground right before brewing.
Before you say I sound like a pretentious hipster, let me say that coffee beans also have the added benefit of staling at a much slower rate than pre-ground coffee—thus making the purchase of whole coffee beans more cost-effective over the long run.
(Yes, I could jump into the hipster barista crusade of freshly-grinding coffee beans for the sake of preserving aroma and flavor notes, but I'll spare you and point you in the direction of Coffee Confidential's excellent page that lists all of the reasons you should put down that bag of pre-ground coffee, stat.)
Let's say you're already on the whole bean bandwagon and are looking to optimize your experience with the coffee you've purchased... but you can't remember when you purchased the bag or how fresh the beans are. Luckily, there is a very easy test you can do to check the freshness of your coffee.
Simply place ½ cup of your whole coffee beans into a ziplock bag, press the air out, and seal the bag. Leave the bag overnight and check on it in the morning: if the bag is puffed with more air, then the beans are fresh. If the bag is flat, then your beans are sadly past their prime.
The process of roasting green coffee beans into those magical brown coffee beans we know and love creates a lot of carbon dioxide. Normally this gas is associated with unfavorable things, such as the greenhouse effect or failing emissions tests. But in the case of coffee, carbon dioxide is good—it forms a barrier against the primary reason for staling in coffee, which is oxygen.
Roasted coffee beans emit a large amount of carbon dioxide when freshly roasted; so much so that a degassing step exists in the roasting process. During this time, the beans are left alone to expel gas and are not fit for consumption. However, after around five days past the initial roast, the beans have lowered amounts of gas emission and are ready for brewing.
These beans continue to emit small amounts of carbon dioxide while fresh, but as time goes by, the amount of gas emitted eventually drops to nothing. At this point, oxygen is able to penetrate the beans and fuels an oxidation process that irreversibly changes the oils and chemical components that make your coffee taste sublime.
So, in short: when you put your beans in an airtight plastic bag and leave them overnight, you trap any carbon dioxide the beans may be emitting. If there is no emitted gas by the next morning, however, then your beans have already started oxidizing and will taste much blander (and possibly rancid, depending on how old they really are).
We've got coffee on the brain 24/7 here at Food Hacks, and the amount of literature we have on the subject is dizzying. Here's a coffee primer if you're looking to learn about the entire process, from bean to brew. You can cook with coffee, recycle coffee grounds, and make your coffee taste better with salt. We've even found ways to use instant coffee—but don't tell your barista friends!