Buy whole beans and keep them whole as long as you can.

Would you cut a cake into pieces the day before you plan to serve it? Would you buy it pre-sliced? Of course not!  The pieces would quickly become stale and the frosting would start to dry out. The same goes for coffee. Grinding the coffee breaks up the beans and their oils, exposes the beans to air, and makes the coffee go stale a lot faster, no matter how you store it. This holds especially true for flavored coffees! For the best tasting coffee, buy your beans whole and store them in a sealed container in a dark place. Grind right before serving.