XML Formatter
Pretty print XML with clean indents, or minify it to one line. Mistakes are reported with the line where the parser stopped.
XML Formatter pretty prints XML with clean indents, or minifies it onto one line. It parses the XML with your browser's own parser, so a file that is not well formed is reported with the line and column where it breaks.
What does an XML formatter do?
Well-formed XML
XML is well formed when every tag is closed, tags nest properly, attributes are quoted and there is one root element. A formatter can only lay out XML that meets these rules, which is why it doubles as a quick check.
Why use XML Formatter?
- Find the error fast. A broken file is reported with the position the parser gave up at, instead of a silent failure.
- Keeps the meaning. CDATA sections, comments, processing instructions and the XML declaration are kept. Minify drops comments only.
- Private. Config files and data feeds stay in your browser.
How to use XML Formatter, step by step

- Paste your XML into XML Formatter. A feed, a config file, a SOAP message or an SVG.
- Choose Pretty print or Minify. Pick the indent for pretty printing.
- Copy or download the result. It updates as you type.
Frequently asked questions
Does it validate against a schema?
No. It checks that the XML is well formed, not that it matches an XSD or DTD.
Is whitespace inside text changed?
Pretty printing trims whitespace at the start and end of text inside an element. If spacing in your data matters, use Minify, which keeps text exactly.
Can it format HTML?
HTML is not always valid XML. Use the HTML Formatter for web pages.
Looking for the long version? The guides cover each of these jobs in depth.