Handitab

XML Formatter

Format XML with two-space indentation and check that it is well-formed, with the parser error shown when a tag or attribute is broken.

About XML Formatter

An XML formatter re-indents a document so its nesting is easy to read. This tool parses the input with the browser's DOMParser, which enforces XML 1.0 well-formedness (matching tags, quoted attributes, one root), then prints each element on its own line with two-space indentation. Comments and CDATA sections inside the root are kept. The XML declaration and DOCTYPE are not written back, and no DTD or XSD validation is performed.

Also known as: XML Formatter & Validator, XML Viewer, XML Validator.

How to use XML Formatter

  1. Type or paste into the "XML" box, or press "Use example" to try it with sample data.
  2. The result appears below and updates as you type.
  3. Copy the result with the copy button, or download it as a file where that is offered.

Questions about XML Formatter

What is the difference between well-formed and valid XML?

Well-formed XML follows the syntax rules: one root element, properly nested and closed tags, quoted attributes. Valid XML also conforms to a schema such as a DTD or XSD. This tool checks well-formedness only.

Runs in your browser. Page last updated .

More developer tools

All 41 developer tools