In situ polymerization of six-membered cyclic 1,3-dioxane leads to a polymer electrolyte with superior oxidation stability and elevated Li-metal compatibility, which enables the stable operation of Li-metal batteries with various state-of-the-art high-voltage cathodes.