Unlike rap or sushi, fresh is not best for coffee. From the point of roasting to brewing there is a fine line between proper degassing and the danger of staling. Degassing occurs as the carbon dioxide generating during roasting leaves the bean through its porous surface. The bulk of the gas disappears within 24 hours but it does continue onward for 14 days. CO2 blocks proper extraction meaning a reduction of taste and an uneven brew. Hence there is a positive relationship between age and extraction for coffee, that is, up to a certain point. Oxygen replaces the CO2 and starts the staling process. Oxidation breaks down the volatile compounds and alters aromatic components meaning a deterioration of flavour (dulled acidity and decreased sweetness). This accelerates with darker roasts because of the increased structural degradation of cell structure.
Thus the recommended window for espresso is 13 to 21 days after roast. For filter, it is 1 to 21 days after roast.
Storage – Fridge? Freezer?
If you are going to enjoy your coffee in the windows outlined above, no need to go close to the fridge. To improve storage during this period, you can put the retail bag into an airtight container, ensure it does not come into contact with moisture, and keep it out of the sun (common vampire/gremlin protocols). However, if you are preparing for end-days, then skip the fridge (because of the moisture exposure via condensation) and put the unopened bag straight to the freezer. The porous nature of roasted coffee means it will absorb the curious odors of its environment, so again, an air-tight container is helpful. When you are ready to brew, simply let it come to room-temperature and grind away. There are many opinions out there but like most coffee lore, the freezer debate usually surrounds traditional roasting and oil-heavy dark roasts.
tl;dr: tap our bags, rest is best, and freezers are okay. Oh, and if you have access to liquid nitrogen, use it.
(Image from a screening of Christian Marclay’s The Clock )