XML Formatter
Paste XML to pretty-print, minify, or validate it. Well-formedness is checked by your browser's own XML parser, and nothing is uploaded.
What this XML formatter does
XML structure is invisible until it is indented: deeply nested elements, attributes and namespaces become readable only once each level sits on its own line. This tool parses your document with the browser's native XML parser, then re-indents the tree. Because the parser does the work, comments, CDATA sections, processing instructions and namespace prefixes are all preserved, and any error stops the format with a clear message.
How to use it
- Format: re-indents the document with 2 or 4 spaces per level. Elements that contain both text and child elements (mixed content) are left on one line so significant whitespace is never altered.
- Minify: removes the whitespace added purely for formatting and collapses the document to a single line, the smallest equivalent representation.
- Validate: reports whether the document is well-formed, and where the first syntax error is if it is not.
Well-formed vs valid
This tool checks that XML is well-formed: tags are balanced, attributes are quoted, and the syntax is correct. It does not check the document against a DTD or XSD schema, which is a separate notion of validity.