XML Formatter

Machine-generated XML arrives as one enormous line. Paste it here and the structure appears: one element per line, indented by depth.

The code never leaves this page: formatting happens in your browser.

How to use

  1. Paste the XML into the first box.
  2. Choose the indent: two spaces, four, or a tab.
  3. Copy the readable version, or press «Minify» to compress it back.

Good to know

Where XML differs from HTML

XML has no void elements — everything either closes or ends with a slash — and it is case-sensitive, so <Item> and <item> are different elements. The formatter treats it accordingly: nothing is assumed to be self-closing, and tag names are never lowercased. That is why this page exists separately from the HTML formatter.

Comments, CDATA and the declaration

A CDATA section can contain anything, including angle brackets that look like tags. It is carried across as one block, as is a comment, so a SOAP envelope with escaped markup inside survives the trip. The XML declaration at the top stays on its own line where parsers expect it.

Frequently asked questions

Does it check that my XML is well-formed?

No. It indents what you give it. A missing closing tag shows up as indentation that never comes back, but no error list is produced.

Will it work with SVG, RSS or a sitemap?

Yes — all three are XML. A sitemap with thousands of URLs becomes readable, and an SVG exported from a design tool stops being a single line.

Is my file sent to a server?

No. Formatting happens in your browser, so an XML export with customer records stays on your machine.

Are attributes reordered or reformatted?

No. A tag is moved to its own line and indented, but what is inside the angle brackets is left exactly as you wrote it.

Related tools