What's the highest theoretical energy density in a chemical battery? Is there a theoretical limit to how energy dense chemical batteries can be? How can one calculate them? And what stops us from reaching those limits?
 A: The maximum theoretical specific energy (MTSE) of a battery can be expressed as $(xE/W_t)F$ J/mol where $x$ is the number of moles of component A that reacts per mole of B, $E$ is the average voltage of the reaction, $W_t$ is the sum of the molecular weights of the reactants and $F$ Faraday's constant  96500 C/mol (Huggins 2008, p. 13). Clearly this is bounded by $E$ (<6 V due to the available electrochemical potentials of the elements) and the minimum possible molecular weight (which is why lithium is appealing for batteries).
Current lithium batteries have a specific energy in the range of 0.360-0.720 MJ/kg, lithium-sulphur batteries reach 1.26 MJ/kg while Li/CuCl$_2$ cells could have an MTSE of 4.197600 MJ/kg (1166 Wh/kg). (Huggins 2008)
Still, the amount of energy that can be released by combustion of materials is several times higher: a kilogram of gasoline has an energy content almost 100 times that of a kilo of a lithium-ion battery. A hypothetical fuel cell burning lithium would achieve 40 MJ/kg while an ideal battery would have a MTSE < 5 MJ/kg. Part of this is cheating by taking oxygen from air, of course.
Hence the upper limit of specific energy would be set by the maximal chemical enthalpy divided by weight. As rocket fuel designers noted, the upper limit of energy stored in chemical systems is bounded by the "Free Atom Limit" corresponding to the heat of combustion when each atom is unbound. This is about 41.5 MJ/kg for nitrogen allotropes, which is about as far as one can go.
The conclusion is that chemical fuel cells can at most achieve some tens of megajoules per kilogram, and batteries about a tenth of that.
Huggins, R. (2008). Advanced batteries: materials science aspects. Springer Science & Business Media.
