XML Formatter
Beautify, minify and validate XML in your browser - with the exact line and column of any error. Nothing leaves your machine.
Beautify, minify and validate XML
XML is still the backbone of countless configs, feeds and enterprise APIs, but a real document often arrives as one unbroken line or with wildly inconsistent indentation. Paste it above and pick Beautify for clean, indented output you can actually read, or Minify to strip every optional space and newline for the smallest possible payload. Validate just checks the document is well-formed and tells you where it breaks if not.
How the beautifier works
Rather than guessing with regular expressions, this tool parses your XML into a real document
tree with the browser own parser, then walks that tree to re-print it. That means attributes
keep their order, an element with a single short text child stays on one line (so
<title>XML</title> is not needlessly split), and structural nodes are
preserved: CDATA is copied verbatim, comments sit on their own lines, and the XML declaration
is kept at the top. Because the output is generated from the parsed tree, malformed input is
caught before anything is printed.
Reading a validation error
When the parser hits a problem it reports the line and column of the first error and a short description - the most common being a start tag with no matching end tag, tags that overlap instead of nesting, an unquoted attribute value, or more than one root element. The caret preview points straight at the offending spot so you can fix it without hunting.
Working with other formats? Convert a document with the XML to JSON converter, tidy data with the JSON formatter, or turn config into YAML with the JSON to YAML converter.