Your best bet is to buy only as much coffee as you’re going to drink in a given week or two. Coffee is like bread, the fresher it is, the better. Air is coffee’s enemy and lessening the coffee’s exposure to air is of paramount importance.
You should store your coffee in a light-proof, airtight container in a cool, dark place like a kitchen cabinet.
There are two schools of thought regarding keeping your coffee in the freezer. One says that coffee contains volatile oils that will evaporate in dry air, and there is no drier air in your house than in your freezer, and that will affect the coffee’s taste. School One says that you shouldn’t put excess coffee in your freezer. The science is kind of simple if you think about it: any moisture in your coffee (and admittedly it’s not much) will be evaporate in the dry freezer air. When you expose those dry beans to moisture again by taking them out of the freezer, they will immediately absorb any moisture they can from the surrounding air. Put them back in the freezer and all that new moisture evaporates. Every time you take frozen beans out of the freezer, they will absorb more moisture. Rinse and repeat… almost literally.
The other school of thought says, what the hell? You’re no connoisseur and it’s better than having the coffee go stale. However, your time is limited and eventually you will notice a difference in the coffee’s taste.
Under no circumstances should you EVER store your coffee in the refrigerator! Your fridge is full of moist, smelly air that will permeate your coffee beans and make them taste bad, bad, bad!
Always buy whole bean coffee, never buy ground! Whole bean coffee, if stored properly, will retain it’s freshness for around a month, ground coffee starts to go stale in a matter of hours.
You shouldn’t pre-grind your coffee, not if you want to retain freshness. Air is coffee’s enemy (there, I’ve said it twice!) and when you grind it you are exposing much more of the bean’s surface area to it.
For the best coffee, grind right before you brew.