You can try to test for freshness by placing beans in a zipper storage bag and letting them sit overnight. If the bag has puffed up, the beans are still fresh since they continue to release carbon dioxide. How magical is that?
The freshness of coffee dissipates soon after it is roasted. As coffee beans lose their freshness, their natural flavors and aromas diminish. To preserve the freshness of your coffee beans for a long time, keep them away from excessive air, moisture, heat, and light.
After opening a new bag of coffee, try to consume all the beans within two weeks.
Store coffee beans in a dry place.
Don't store your coffee beans in the freezer since freezer burn could ruin the coffee.
Don't store the beans in transparent or translucent jars or canisters.
Don't keep your coffee beans near any windows.