XML Formatter and Validator
Pretty-print or minify XML, with the line and column when it will not parse.
About this tool
Formats XML with indentation, minifies it, or checks whether it parses — and when it does not, tells you the line and column rather than just "error".
External entities are disabled. A document that pulls a DTD from a URL, or reads a local file through an entity declaration, is the classic XXE attack; a formatter that resolves entities would read server files on behalf of whoever pasted the document. Entity declarations here are reported, not followed.
The most common real failure is a bare `&`. It must be written `&` even inside a URL, and one of them makes the entire file fail to parse.
Common questions
Why does my XML not parse?
Nearly always a bare ampersand. It must be &, even inside a URL in an attribute. After that: a tag that is not closed, or two root elements where XML permits exactly one.
What is an XXE attack?
An entity declaration that makes the parser fetch a URL or read a local file, then include the contents in the document. Any parser that resolves entities on untrusted input is vulnerable. They are disabled here.
Does formatting change the document?
Whitespace between elements is added or removed, which is not significant in most schemas. It is significant inside mixed content — text with inline markup — so check formatted output before overwriting a document of that kind.
Can I format an HTML file with this?
Only if it is XHTML. Ordinary HTML allows unclosed tags like <br> and <img>, which are not valid XML, so it will report errors that are perfectly fine in HTML.