XML Formatter

Indent minified or machine-generated XML into a readable tree, and check it for well-formedness errors.

About this tool

XML documents often arrive compressed onto a single line — from SOAP responses, build files, RSS feeds or configuration exports. This formatter re-indents every element with your chosen indentation, while preserving comments, CDATA sections and the XML declaration.

How to use it

  1. Paste your XML into the input box, or click Sample.
  2. Click Format / Beautify to indent it, or Minify to strip the whitespace again.
  3. Use Validate to confirm the document is well-formed before you process it elsewhere.

Good to know

  • Validation checks well-formedness (matching tags, proper escaping, one root element). It does not validate against a DTD, XSD or Relax NG schema.
  • Whitespace-only text between elements is removed when formatting, which is what you want for data-oriented XML.
  • Processing instructions such as <?xml-stylesheet …?> are kept on their own line.