XML Formatter & Validator
XML Formatter re-indents an XML document and reports the first structural problem it finds.
How to use it
- Paste your XML into the input box
- Click Format to get a consistently indented result
- Read the error message if the XML isn't well-formed
It checks well-formedness only — matched tags, exactly one root element, and no text outside it — and names the first fault (an unclosed tag, a mismatched closing tag, stray text, or more than one root). It does not validate against a DTD or XSD schema, resolve or check entities such as the ampersand escape, or verify namespace prefixes; an xmlns is treated as an ordinary attribute. Indentation is fixed at two spaces per level, and whitespace inside text nodes is trimmed, so significant spacing in mixed content is not kept. Unlike the JSON tools it never rebuilds the data model, so nothing is re-ordered; there is also no XML minifier. Input is limited to 2 MB, roughly 100,000 tags and 64 nesting levels, and the document stays in your browser.
FAQ
No. It only checks that the document is well-formed — tags matched, one root, no stray text. Schema validation, entity resolution and namespace checks are out of scope.
No. It is always two spaces per level. Text inside elements is also trimmed, so leading and trailing spaces in a text node are dropped.
The JSON Formatter and Minifier re-parse the data, which can re-order keys or lose number precision. This tool only re-indents the text, and there is no XML minify option.