XML Formatter & Validator

Pretty-print and validate XML instantly in your browser.

Input XML
Output

About the XML Formatter

This tool uses the browser’s built-in DOMParser to parse your XML and the XMLSerializer to re-serialize it. The indentation is applied with a custom tree-walk, preserving all attributes, namespaces, and processing instructions.

Validate checks whether the XML is well-formed (matching tags, proper nesting, valid attribute quoting). It does not validate against a DTD or XML Schema.

Minify removes all whitespace-only text nodes between elements, producing the most compact possible output.