XML formatter

Prettify your XML string into a friendly, human-readable format.

About XML formatter

Indents an XML document so its structure is easy to read, with a configurable indent size and an option to keep short text content on the same line as its element. Invalid XML is reported instead of being formatted.

When you would use it

How to use it

  1. Paste the XML into the left field.
  2. Set the indent size (0 to 10 spaces) and toggle "Collapse content".
  3. Copy the formatted result.

Things worth knowing

Frequently asked questions

Why is my XML reported as invalid?
Common causes are an unclosed tag, an unescaped & or < in text (write &amp; and &lt;), attribute values without quotes, or several root elements. HTML is not XML, so an HTML page usually fails too.
Can it minify XML instead?
Not directly. Set the indent size to 0 to remove indentation, which produces a compact but still line-broken document.

All the tools