XML Formatter

No upload · runs in your browser
Indent
Empty tags
XML in
0 characters
Formatted

Runs entirely in your browser, nothing is uploaded.

How it works

XML Formatter and Validator: Pretty Print or Minify

Paste XML to indent it from the parsed document tree, or minify it back down. Comments, CDATA and the XML declaration survive, mixed content is left alone, and errors quote the parser’s own message.

What this does
  • Re-indents the parsed document tree, so this is a real pretty-print rather than a regex patch
  • Mixed content is reproduced verbatim, re-indenting an element that holds both text and child tags would change what it says
  • Comments, CDATA sections, processing instructions, the DOCTYPE and the XML declaration all come through
FAQ

Editors tolerate what XML does not. The usual culprits are a bare & that should be written &amp;, a stray < inside text, mismatched or unclosed tags, an undeclared namespace prefix, or more than one root element in the file. The error banner repeats the parser’s own message with its line and column, which is normally within a character of the real problem.

Keep going