Solid-state electrolytes with high room-temperature ionic conductivity and fast interfacial charge transport are a requirement for practical solid-state batteries. Here, we report that cationic aluminium species initiate ring-opening polymerization of molecular ethers inside an electrochemical cell to produce solid-state polymer electrolytes (SPEs), which retain conformal interfacial contact with all cell components. SPEs exhibit high ionic conductivity at room temperature (>1 mS cm−1), low interfacial resistances, uniform lithium deposition and high Li plating/striping efficiencies (>98% after 300 charge–discharge cycles). Applications of SPEs in Li–S, Li–LiFePO4 and Li–LiNi0.6Mn0.2Co0.2O2 batteries further demonstrate that high Coulombic efficiency (>99%) and long life (>700 cycles) can be achieved with an in situ SPE design. Our study therefore provides a promising direction for creating solid electrolytes that meet both the bulk and interfacial conductivity requirements for practical solid polymer batteries.