XML Formatter

Paste your XML, click Format, and get clean indented output. Malformed XML will show a readable error message.

Why Use the XML Formatter?

Raw XML is often delivered as a single line or with inconsistent indentation, making it nearly impossible to read. This tool pretty-prints your XML with consistent indentation so you can quickly understand the document structure, spot nesting issues, and debug configuration files, API responses, or data feeds. Need to do the opposite? Use the XML Minifier to compress formatted XML into a single line.

If your XML contains errors, try our XML Validator first to identify syntax problems before formatting. You can also learn more about XML fundamentals in our tutorials.

Example Input

Paste minified or poorly indented XML like this:

<catalog><book id="1"><title>XML Developer's Guide</title><price>44.95</price></book><book id="2"><title>Midnight Rain</title><price>5.95</price></book></catalog>

Example Output

The formatter produces clean, indented XML:

<?xml version="1.0" encoding="UTF-8"?>
<catalog>
  <book id="1">
    <title>XML Developer's Guide</title>
    <price>44.95</price>
  </book>
  <book id="2">
    <title>Midnight Rain</title>
    <price>5.95</price>
  </book>
</catalog>