XML Formatter and Validator
Make XML readable with consistent indentation, minify it for sending, and find structural errors such as mismatched tags with their line numbers.
Result
Paste XML to check, format or minify it.
How to use this tool
- Paste XML, such as a sitemap, RSS feed, SVG or SOAP message.
- Choose Format (2 spaces, 4 spaces or tabs) or Minify.
- If the XML is not well-formed, the first problem is shown with its line number.
How it works
The XML is split into tags, text, comments, CDATA sections, processing instructions and DOCTYPE declarations. Opening and closing tags are matched with a stack, so the first unclosed or mismatched tag can be reported. Formatting puts each element on its own line and keeps short text inline (as in <x>1</x>). Minifying removes comments and whitespace between tags.
Example
Finding a mismatch
In <a> followed on line 2 by <b></a>, the tool reports “<b> on line 2 is closed by </a> on line 2.”
Privacy and limitations
- Everything runs in your browser; nothing you paste is uploaded or stored.
- The check covers well-formedness. It does not validate against a DTD or XML Schema, and does not resolve entities.
- Whitespace inside text is trimmed when formatting, which can matter for mixed content.
Frequently asked questions
Can it format HTML?
Only XHTML or other HTML that follows XML rules. Ordinary HTML allows unclosed tags such as <br>, which XML does not.
Does it change attribute values?
No. Only the whitespace between attributes is normalised.