You can keep a bottle of wine for years, decades even, and in most cases, that wine will only taste better with time. Beer, however, is a totally different beast. Unlike wine and some liquors, the shelf-life of beer is actually pretty short, and beer can expire. And old beer tastes bad. It can be sulfurous or sour, with notes of vinegar, or it can taste like wet cardboard. So how do you prevent beer from spoiling and keep the beer in your fridge as fresh as possible for as long as you can? 

You first have to understand the factors that affect the lifespan of a beer, starting with its composition. In general, the more alcoholic and hoppy the beer is, the longer it'll last. "For example, consider the origin of the IPA," notes Joe Bisacca, the CEO and cofounder of Elysian Brewing Company. "It was a pale ale created in the UK and sent to India for the colonial British troops. IPAs were more alcoholic and had more bittering hops to keep them stable for the long voyage." This is why an IPA or stout will last longer than a pilsner.

The cleanliness of the brewery can make a difference as to how long the beer will last, as will the way you store your beer. And the most important factor to consider if you're trying to keep beer fresh is light. "Light kills beer," says Bisacca. And there's a scientific reason for that. As Harold McGee writes in On Food and Cooking: The Science and Lore of the Kitchen, "It turns out that light in the blue-green to ultraviolet parts of the light spectrum reacts with one of the hop acids to form an unstable free radical, which in turn reacts with sulfur compounds to form a close relative of chemicals in the skunk’s defensive arsenal." (Ever heard of "skunked" beer? That's this.)

And it doesn't take that much light exposure to affect beer. "A cup of beer at a picnic can go skunky in a few minutes," writes McGee, while a, "bottled beer in a fluorescent-lit display case may deteriorate in a few days." Beer is clear or green glass bottles are more susceptible to light damage than those in brown bottles. So go for a can if you have any doubt about the beer's age, or want to keep it for a long time; it's a "total blackout," notes Bisacca.

Even if you do store beer properly and buy a big, hoppy brew, the taste of your beer will still deteriorate over time, and a week-old beer will taste different than one that's straight out of a keg. "That wonderful hoppy aroma we all love fades on its own as the molecules break down naturally," says Bisacca, so he recommends, "A good IPA should be drunk within 90 days of packaging, a stout within 9 months to a year," but notes that a "barrel aged big beer can take years to deteriorate!"

The bottom line? "Fresher is always better," according to Bisacca. So only buy as much beer as you're planning on drinking, and drink it as soon as you can. You don't want it to go bad, do you?