Scientists have identified the chemicals that lead to the bitter aftertaste of stale bottled beer.
Chemicals present in beer's hops break down over time, forming other compounds that result in the unpleasant taste.
Researchers reporting in the Journal of Agricultural and Food Chemistry say the trick to avoiding the taste is to avoid that breakdown.
That can be done by adjusting beers' acidity when it is produced, and by always keeping it cool.
The idea that the naturally-present, slightly bitter-tasting compounds are the source of the more bitter, more long-lasting flavours of "aged" beer is not new.
But the exact catalogue of compounds that are responsible and how they develop over time has remained a mystery until now.
Researchers at the Technical University of Munich (TUM) have been looking into the particulars of beer chemistry for a number of years.
For the recent study, they stored a number of commercially available, pilsner-style beers for as much as 10 years in order to compare the chemistry of aged beers with that of freshly-obtained samples.
The primary offenders are what are known as trans-iso-alpha acids, which over time degrade into a number of chemicals that lead to bad taste - and it is these that the TUM researchers hope to address.
Recent studies have shown that the level of acidity, or pH, has a strong effect on the degradation of trans-iso-alpha acids, but the new study indicated that pH in ageing beer was incredibly stable - so the researchers asked a commercial brewer to make batches of beer with slightly varying pH levels.
They found that by making beer that was incrementally less acidic, the trans-iso-alpha acid degradation process could be much reduced.
However, the reactions that transform the acids into the ingredients of a stale-tasting beer are accelerated at higher temperatures, so the simplest route to keeping beer tasting fresh is to keep it cool.