Free Online XML Formatter
Format, minify and validate XML documents. No external entity resolution — safe browser-side processing.
Input
Output
What is XML formatting?
XML formatting adds consistent indentation and line breaks so markup is easy to read and debug. Minifying removes whitespace to reduce size.
Security
The parser does not resolve external entities or load external DTDs, so XXE-style attacks are not possible here. Malformed documents are rejected with a clear error.
Example input
XML Formatter FAQ
Are external entities resolved?
No. Parsing uses the browser's DOMParser, which does not fetch external DTDs or entities. This avoids XXE-style attacks and keeps the tool safe for untrusted documents.
Does it validate against an XSD or DTD?
No. It checks that the document is well-formed XML — correctly nested and closed tags, valid attributes and a single root element. Schema validation is a separate step.
Are comments and CDATA sections preserved?
Yes. Formatting re-serializes the parsed document, so comments, CDATA sections and text content are retained. Only insignificant whitespace between elements is adjusted.