XML Formatter & Validator
Paste XML to pretty-print it, minify it, or check that it is well-formed. All processing happens in your browser.
XML still powers the world’s invoices, feeds, and enterprise APIs, and it usually arrives as one unreadable line. This tool pretty-prints XML with clean 2-space indentation, minifies it for transport, and validates well-formedness — catching the unclosed tags, mismatched quotes, and stray ampersands that break parsers. Everything runs locally using your browser’s own XML parser.
How to format XML
- Paste your XML into the input box.
- Click Format to pretty-print with 2-space indentation (attributes stay on their element’s line).
- Click Minify to collapse whitespace between tags into one compact line.
- Click Validate to check well-formedness — errors point at the actual problem (unclosed tag, bad nesting, unescaped &).
- Click Copy to take the result with you.
XML formatting example
This minified XML:
<catalog><book id="1"><title>Dune</title><author>Herbert</author></book></catalog>formats to:
<catalog>
<book id="1">
<title>Dune</title>
<author>Herbert</author>
</book>
</catalog>Frequently asked questions
What is the difference between well-formed and valid XML?
Well-formed means the syntax rules hold: one root element, every tag closed, attributes quoted, correct nesting. Valid means it also conforms to a DTD or XSD schema. This tool checks well-formedness — schema validation needs the schema file itself.
Does it keep comments?
Yes — comments and processing instructions are preserved when formatting. Whitespace-only text between elements is discarded.
Is my XML uploaded?
No. Parsing, formatting, and minifying all use your browser’s built-in DOMParser — the document never leaves your device.