How to use the XML formatter
Configuration files and API responses often arrive as XML squeezed onto a single line, which makes the structure impossible to follow. Paste it here and each opening tag adds one level of indentation to everything nested inside it. Pick two spaces, four spaces or a tab, and copy the result straight from the button below the output.
Validation uses the XML parser already built into your browser. If a tag is left unclosed or an attribute quote is missing, the parser message is shown as-is instead of a result, which usually points straight at the line to fix. Input is accepted up to 200,000 characters.
What this tool does is indentation-level tidying, not a full rewrite. Attribute order and the spacing inside an attribute are left exactly as they were. Comments, CDATA sections, the XML declaration and DOCTYPE keep their contents and stay on one line without adding a nesting level. Self-closing tags do not open a level, so the next line is not pushed inwards. Text between tags moves onto its own line and loses surrounding whitespace, so documents where whitespace is significant are not a good fit. Everything runs in your browser and nothing is uploaded.
Frequently asked questions
Yes. Comments and CDATA sections keep their contents and stay on a single line. Line breaks already inside them remain, so such a line can look long.
It is not recommended. HTML allows closing tags to be omitted, which an XML parser usually reports as an error. XHTML, where every tag is closed, works fine.