XML Formatter & Beautifier
Pretty-format supported element-only XML with explicit2,3or4-space indentation. Preserve mixed text, CDATA and xml:space subtrees without reflow.
English tool page. Existing tools and locale routes remain in the site catalog.
Examples and supported behavior
<catalog><book><title>Example</title></book></catalog>
<catalog>
<book>
<title>Example</title>
</book>
</catalog>Adds2,3or4-space indentation only to containers made entirely of elements, comments or processing instructions. Any text node (including existing whitespace), CDATA, or xml:space="preserve" keeps that entire subtree without reflow, including descendants. xml:space="default" inside a preserved subtree does not override this conservative choice; unsupported values are rejected. Comments, CDATA, processing instructions and the XML declaration remain ordered. Existing XML normalization changes line endings, attribute whitespace/quoting, declaration spacing and output encoding declarations toUTF-8. This is not byte preservation, canonicalization, schema validation or repair. DTD/custom entities/external resources are rejected. Limits:100,000 input characters,10,000 nodes/attributes,40 element levels and1,000,000 output characters. Generated indentation counts toward the10,000-node output budget; near-limit documents may need the existing non-indenting serializer.
Existing XML Formatter: parse and serialize without indentation · All tools