XML Formatter & Validator

Paste XML to indent it neatly, check that it is well-formed, or compress it to a single line.

✓ Runs locally in your browser — nothing is uploaded

In short: An XML formatter checks that a document is well-formed and re-indents it so each element sits on its own line, or strips the whitespace to minify it.

About XML Formatter & Validator

XML is still everywhere: sitemaps, RSS feeds, SVG files, SOAP APIs, Android layouts, Maven POMs and office documents. When it arrives minified or badly indented, a formatter makes the nesting visible and quickly tells you whether the document is well-formed.

Validation uses your browser’s built-in XML parser (DOMParser), the same one that reads SVG and XHTML, so its verdict on well-formedness is strict and reliable. It checks matching tags, quoting and entity syntax; it does not validate against an XSD or DTD schema.

How to use XML Formatter & Validator

  1. Paste your XML into the input box.
  2. Choose an indent size.
  3. Press Format to pretty-print or Minify to remove whitespace between tags.
  4. If there is an error, the message shows the line and reason reported by the parser.

Examples

Sitemap entry

<urlset><url><loc>https://tool.sb/</loc></url></urlset> is expanded to three indented levels.

Mismatched tag

<a><b></a> fails with an error saying the end tag does not match the opening b tag.

Frequently asked questions

Does it validate against an XSD schema?

No. It checks that the XML is well-formed (correct syntax). Schema validation needs the schema file and a validating parser.

Are comments, CDATA and processing instructions kept?

Yes. Comments, CDATA sections and the XML declaration are preserved in the output.

Will whitespace inside text be changed?

Text content is trimmed of leading and trailing whitespace for readability. If whitespace inside elements matters (for example in xml:space="preserve" content), check the output.

Is my XML sent anywhere?

No. Parsing and formatting happen in your browser. You can check this yourself: open your browser’s developer tools, switch to the Network tab and use the tool — no request carries your input.

Updated November 2026 · Free, no signup · How we build and test tools

Related tools All developer tools →