They will technically last a long time in the freezer - up to many months - but this is not the best way to store them as they lose flavor quickly (as little as 5-6 uses). Even though the beans will last, storing them in the freezer is not ideal. It affects flavor for a number of reasons. (See below)
If you haven't opened the bag, store the bag in the cupboard, away from sunlight, heat, and excess humidity.
The best way to store coffee beans after being opened is in an opaque, airtight container at room temperature (unless you have a resealable bag with a degassing valve designed for storing coffee). After being opened, the beans are considered fresh for 2-3 weeks, although if you are strict about the storage you may be able to get up to 5 out of them. (When I say fresh, I mean with minimal flavor change/loss)
Why the freezer is bad:
Freezing beans severely lowers the humidity in the bag or container. This causes the beans to become stale very quickly. In effect, you are slowly freeze drying them. Also using cold beans in a grinder can mess with grind due to the oil on the beans being in a more solid state, which in turn affects the brewing.
If you do decide to store them in the freezer, put them in an airtight container and when you go to use the beans let the container warm up to room temperature before opening. This way you do not mess with the overall humidity content of the container too much. Especially let them warm up to room temperature before grinding.
I am a Barista in a cafe and a lover of coffee at home. I have tried both methods of coffee storage and have dealt with many customers who have tried both.
In my store we follow these regulations:
- Beans that go into an opaque container that is not totally airtight are fresh for two weeks max.
- Packaged beans with a degassing valve are fresh for six months or longer in the bag.
- Beans, once ground, cannot be used after two hours (that being said, ground coffee starts losing flavor immediately).
Obviously, the sooner you use everything the better, but we follow those guidelines.