Coffee is best stored in an airtight container made of ceramic, glass, or non-reactive metal.[93] Higher quality prepackaged coffee usually has a one-way valve which prevents air from entering while allowing the coffee to release gases.[94] Coffee freshness and flavor is preserved when it is stored away from moisture, heat, and light.[93] The ability of coffee to absorb strong smells from food means that it should be kept away from such smells.[93] Storage of coffee in the refrigerator is not recommended due to the presence of moisture which can cause deterioration.[93] Exterior walls of buildings which face the sun may heat the interior of a home, and this heat may damage coffee stored near such a wall.[93] Heat from nearby ovens also harms stored coffee.[93]
In 1931, a method of packing coffee in a sealed vacuum in cans was introduced. The roasted coffee was packed and then 99% of the air was removed, allowing the coffee to be stored indefinitely until the can was opened. Today this method is in mass use for coffee in a large part of the world.[95]