Coffee does not really spoil, it goes flat. Roasted beans keep releasing carbon dioxide for weeks after roasting, and the oils that carry the aroma oxidize. That is why a roast date on the bag tells you far more than a best by date printed a year into the future.
Staling is three things happening at once
Roasting traps a large volume of carbon dioxide inside each bean. That gas escapes over the following weeks, and on its way out it carries aromatic compounds with it. This is the bloom you see when hot water hits fresh grounds, and it is also why coffee roasted yesterday can brew unevenly while coffee roasted ten days ago hits a sweet spot.
Meanwhile, oxygen attacks the lipids in the bean, which eventually reads as stale and faintly rancid. And coffee is hygroscopic, so it pulls in both moisture and the smell of whatever is sitting next to it. A bag stored beside onions will taste like it.

Ground coffee ages much faster, and here is the math
Grinding multiplies the surface area exposed to oxygen enormously. A whole bean has a hard, roughly sealed exterior. The same bean ground fine becomes thousands of particles, each with fresh surfaces. Preground coffee can lose most of its aromatic punch within days of the bag being opened, which is the entire argument for owning a grinder. If you buy ground, buy small bags more often rather than one big one.
How long each form holds up
| Form | Best flavor window | Still drinkable |
|---|---|---|
| Whole bean, unopened valve bag | Two to four weeks from roast date | Several months |
| Whole bean, opened | About two weeks | A month or two, fading |
| Ground, opened | A few days | A few weeks, noticeably flat |
| Instant, sealed | A year or more | Long past that if kept dry |
| Brewed black, on a hot plate | Under thirty minutes | Hours, but it tastes burnt |
| Brewed black, sealed in the fridge | A day | Three to four days |
| Anything with milk added | Drink it | Follow standard dairy guidance |
Once dairy is in the cup, the question stops being about flavor. FoodSafety.gov publishes the refrigeration rules for milk based drinks and the two hour room temperature limit, and those are the numbers to check rather than anything about coffee.
Storage habits worth dropping
The clear canister on the counter looks great and exposes beans to light all day. The refrigerator is the worst common choice, because it combines moisture with a cabinet full of competing odors. The bag’s one way valve exists to let carbon dioxide out without letting oxygen in, so the original bag with the top rolled and clipped often beats whatever jar you transfer it into.
What does work is boring: opaque, airtight, room temperature, away from the stove, and buying an amount you will actually finish in two or three weeks.