XML Formatter
Indent and format XML documents cleanly.
XML Input
Formatted XML
About the XML Formatter
The XML Formatter indents an XML document so the nesting is visible. Paste markup, choose two spaces, four spaces or tabs, and the same document comes back aligned.
XML is whitespace-sensitive in specific places. Text inside an element is content, and adding indentation around it can change the value a consumer reads. That is why formatters generally leave element text alone and only adjust the whitespace between tags.
It does not validate against a schema or check well-formedness beyond basic structure. A missing closing tag will still be missing afterwards; run it through a validator if correctness matters.
Common questions about XML Formatter
Will formatting change my data?
Not if the text sits inside elements, which is preserved. Only whitespace between tags is adjusted.
Does it validate the XML?
No. It formats only. Use a schema validator to check correctness.
How is CDATA handled?
CDATA sections are treated as literal text and are not reformatted.
Can it handle large documents?
Moderately large files are fine. Very large ones are slower because the work happens in the browser.
Does it fix self-closing tags?
It preserves them.
Can I minify XML instead?
This page indents. Removing all inter-tag whitespace by hand is usually enough for minifying.