ToolDashy

XML Formatter

Pretty-print XML with proper indentation to make it readable, or minify it down to remove unnecessary whitespace — with clear errors if the XML is malformed.

Everything you enter is processed in your browser and isn't sent to our servers.

How to use XML Formatter

  1. 1Paste your XML.
  2. 2Click Pretty print for readable, indented output, or Minify to compress it.
  3. 3Copy the result or download it as a .xml file.

About this tool

Pretty printing adds consistent indentation so nested elements are easy to read at a glance — useful when you're handed a single-line XML response from an API or log file. Minifying does the opposite: it strips whitespace between tags to produce the smallest valid representation of the same document.

Both operations parse the XML into a structure first, so a malformed document (like a tag that's never closed, or mismatched opening/closing tags) is caught and reported clearly rather than producing garbled output.

Worked example: paste <order id="42"><item sku="A1">2</item><note><![CDATA[Leave at door]]></note></order> and choose Format to get a four-line document with each child element on its own line, indented by two spaces; Minify turns it back into a single line. A few things are normalised along the way: the <?xml …?> declaration and comments are left out, CDATA sections are written as ordinary escaped text, and spaces at the start or end of a text value are trimmed — so keep the original if you need those exactly as they were.

Frequently asked questions

No — the elements, attributes, nesting and text values are kept, so the data means the same thing. A few things are normalised, though: the XML declaration and comments are dropped, CDATA sections are written as escaped text, and spaces at the start or end of a text value are trimmed. If you need those kept exactly, keep a copy of the original.

Related tools