The performance of lithium–sulfur batteries is intimately tied to electrode porosity. Now, an in-depth investigation shows that optimizing the porosity enhances the achievable energy density of lithium–sulfur batteries.