Chaos is a phenomenon that occurs in many aspects of contemporary science. In classical dynamics, chaos is defined as a hypersensitivity to initial conditions. The presence of chaos is often unwanted, as it introduces unpredictability, which makes it difficult to predict or explain experimental results. Conversely, we demonstrate here how chaos can be used to enhance the ability of an optical resonator to store energy. We combine analytic theory with ab initio simulations and experiments in photonic-crystal resonators to show that a chaotic resonator can store six times more energy than its classical counterpart of the same volume. We explain the observed increase by considering the equipartition of energy among all degrees of freedom of the chaotic resonator (that is, the cavity modes) and discover a convergence of their lifetimes towards a single value. A compelling illustration of the theory is provided by enhanced absorption in deformed polystyrene microspheres.