The general rule of thumb, whether you buy your coffee at Costco or the corner roaster's, is this: Whole beans last longer than ground coffee. Unopened, a bag of beans will last from 6 to 9 months, in some cases up to a year depending on how its stored, and ground coffee will last for a few months. Assuming you grind your beans daily and keep the rest stored properly, you can keep them in the pantry for quite awhile. But if you bought a 5-pound container of ground Colombian coffee, the freshness clock starts ticking as soon as you open it. The San Francisco Bay Coffee Co., which is sold at Costco and other big-box stores, recommends keeping ground coffee in a non-refrigerated, airtight container and using it as quickly as possible. The longer it sits around, the more flavor it will lose. If you love instant coffee, then go right ahead and stock up. The freeze-dried stuff will last up to 20 years unopened.
Related: 10 Local Coffee Roasters That Put Starbucks to Shame