The entire goal of coffee farmers, roasters, and baristas, is to bring the most flavor possible out of a coffee bean. The goal is to get what is inside the bean to come out of the bean.
When you grind the beans ahead of time, it discounts all of the work that has gone into the coffee and counts it pretty much useless.
(Pictured above: Coffee barista smiling because he drinks fresh ground coffee)
When the cells inside the coffee beans are exposed to air, the volatile aromas react with the oxygen in the air and perform oxidation. What happens is that the beans are rapidly reacting and essentially losing their aroma and flavor every second. After just 15 minutes of being ground, coffee loses more than 60% of its aroma! After a day or two of being ground, coffee has lost almost all of its flavor. If the coffee has been ground for 5 or 6 days, it has then essentially lost all of its flavor and it is almost irrelevant how much longer you leave it; it’s a lost cause.
What also happens is that the oils in the coffee begin to dilute by the exposure to the moisture in the environment.
Another striking problem is that coffee oils are very delicate, and in turn can easily be contaminated. Whatever odors are around your grounds will then take form inside your coffee beans. Have you ever noticed that your coffee tastes kind of like the plastic container you kept it sealed in? Or maybe it kind of tastes like your drinking a piece of metal like the tin it came locked in? Your observations are warranted as the oils in the coffee are essentially sucking up fragments of those materials and in turn are making your beverage taste like them.
Carbon Dioxide plays a major role in getting the essential oils into the coffee after they are released. The problem is that after beans are ground, it increases the surface area of the coffee that is exposed (compared to whole beans which simply expose the outer shell). When the grounds are exposed, the C02 is released. Within 60 seconds of grinding coffee beans, 80% of the gas is released into the air (hence why it smells so good). It then begins to multiply in loss in the minutes following.
For the most flavor, simply wait until the last minute to grind your beans!
Hear my plea:
To make coffee better, wait to grind the beans until you brew the coffee.
Here is a super affordable but very reliable coffee grinder that I have used for years: