Battery shelf life is determined by the type and composition of the battery. It is based on the self discharge rate of the battery, however that rate can be affected by the ambient temperature in which the batteries are stored. Most batteries shipped from DigiKey older than 2 years(1 year for lead acid batteries) are tested for charge before shipment.
There are two main categories of batteries, non-rechargeable (primary) and rechargeable (secondary) batteries. The definition for the shelf life of each is slightly different.
For primary batteries shelf life is how long they will hold their charge without use. Average shelf life is as follows based on composition:
Alkaline 5-10 years.
Carbon Zinc 3-5 years.
Lithium 10-12 years.
For secondary batteries it is how long the battery can sit before it needs charged or expiring. Average shelf life is as follows based on composition:
Nickel Cadmium 3 years.
Nickel Metal Hydride 3-5 years.
Lithium 2-4 years.
Lead Acid 6 months.
Pure Lead Acid 8 years.
These numbers are based off of self discharge rates such as the following:
Lastly the temperature that batteries are stored at can greatly affect the shelf life of a battery. Ideally they should be kept below 60oF(15oC). Here is a guide to storage temperatures:
For more detailed information and tips on storage and handling visit:
Battery Shelf Life | Fulfillment And Distribution
Battery Expiration Guide (batteryjunction.com)