Here, we show that I -oxidation in microporous carbon (pore size < 2 nm) produces solid I2, which can reach pore fillings of at least 30 % and which in the iodide electrolyte partly dissolves into I3 -and I5 -. The latter are responsible for self-discharge via shuttling. In situ Raman and ex situ ultraviolet-visible (UV-vis) spectroscopy confirm I2, I3 -and I5 -during positive polarization and their reduction into I -during negative polarization. In situ SAXS/WAXS data show that a majority of these species is confined to the carbon nanopores. Combined with stochastic modeling, in situ SAXS quantifies the amount of solid iodine deposit and visualizes its structural evolution in the pores. Based on the derived reaction mechanism, we show that high capacity with low self-discharge requires a small concentration of mobile polyiodides and a large fraction of immobile iodine deposits.