142+ Free Online Tools · Easy. Fast. Accurate.

XML Formatter

Pretty-print XML with consistent indentation, instantly in your browser.

How to use the XML Formatter

  1. Paste your XML.
  2. Choose the indent size in spaces.
  3. Click Run and copy the formatted XML.

How the XML Formatter works

The formatter parses the XML with your browser's built-in XML parser, which checks that it's well-formed, and then writes the document tree back out with each nested element indented one level deeper than its parent. Attributes, text content and comments are kept.

If the XML is malformed, for example a tag isn't closed or elements overlap, you get the parser's error instead of incorrect output. Use it for config files, SOAP messages, RSS feeds and sitemaps.

Frequently asked questions

Is this tool free?
Yes. Format XML at no cost, with no account required.
What happens if my XML is invalid?
You'll see an error message describing what's wrong so you can fix it. Use the XML Validator for a dedicated validity check.
Does my text leave my browser?
No. The conversion runs entirely in your browser, so your text is never sent to a server.

More Text Tools

Browse all Text Tools →