XML Formatter

Format and validate XML with clean, nested indentation.

What is the XML Formatter?

This tool parses XML using your browser's built-in XML parser, checks that it's well-formed, and reformats it with clean, nested indentation that mirrors the document's element structure.

How to use it

  1. Paste your XML into the input box.
  2. Choose an indent size and click Format XML.
  3. If the XML isn't well-formed, an error message tells you so.

XML is still widely used for configuration files, SOAP APIs, RSS/Atom feeds, and data exchange between enterprise systems, and like HTML, a document with no consistent indentation can be very difficult to read once it's more than a few elements deep. Because this tool relies on the browser's native DOMParser, "well-formed" here means valid according to the same strict XML rules any standard XML library would enforce — every tag must be properly closed and nested, and attribute values must be quoted.