Skip to content
Utilerio

XML Formatter

Format, indent and validate XML documents in your browser.

Result

The result will appear here.

Was this tool useful?

About this tool

XML that comes from a web service or configuration file is often minified for transport efficiency. Formatting adds the indentation that makes the tag hierarchy readable; minifying removes it again for production use.

The formatter parses the XML first, so it will report an error if the document is not well-formed. This doubles as a quick validity check.

How to use it

  1. Paste your XML into the left panel.
  2. Choose Format (to indent) or Minify (to compress).
  3. For formatted output, pick 2 or 4 spaces of indentation.
  4. Copy the result.

Examples

Minified → formatted

<catalog><book id="1"><title>Clean Code</title><author>Martin</author></book></catalog>
<catalog>
  <book id="1">
    <title>Clean Code</title>
    <author>Martin</author>
  </book>
</catalog>

Common problems

Parse error on valid-looking XML.
Common causes: missing closing tag, an unescaped < or & in a text node, or two root elements. XML requires exactly one root element and strict escaping.

Frequently asked questions