The ability to store energy enables organisms to deal with temporarily harsh and uncertain conditions. Empirical studies have demonstrated that organisms adapted to fluctuating energy availability plastically adjust their storage strategies. So far, however, theoretical studies have investigated general storage strategies only in constant or deterministically varying environments. In this study, we analyze how the ability to store energy influences optimal energy allocation to storage, reproduction, and maintenance in environments in which energy availability varies stochastically. We find that allocation to storage is evolutionarily optimal when environmental energy availability is intermediate and energy stores are not yet too full. In environments with low variability and low predictability of energy availability, it is not optimal to store energy. As environments become more variable or more predictable, energy allocation to storage is increasingly favored. By varying environmental variability, environmental predictability, and the cost of survival, we obtain a variety of different optimal life‐history strategies, from highly iteroparous to semelparous, which differ significantly in their storage patterns. Our results demonstrate that in a stochastically varying environment simultaneous allocation to reproduction, maintenance, and storage can be optimal, which contrasts with previous findings obtained for deterministic environments.