XML formatter

Validate, beautify or minify XML.

  • Development
  • 100% free
  • No sign-up
  • Runs in your browser
XML formatter

What is the xml formatter?

The XML formatter checks that an XML document is well-formed and rewrites it with consistent indentation, one element per line. Switch to minify to remove the whitespace between elements and the comments.

Errors are reported with the parser's message, so you can find a missing closing tag or an unescaped & in sitemaps, RSS feeds, SVG files, SOAP messages and configuration files.

How to use the xml formatter

  1. 1Paste the XML, or upload a file.
  2. 2Choose Beautify or Minify and the indentation.
  3. 3Press Format and copy or download the result.

Features

Error check

Malformed XML is reported with the parser error.

Beautify

2 spaces, 4 spaces or tabs.

Minify

Remove whitespace and comments.

Keeps the details

XML declaration, doctype, CDATA and namespaces are kept.

Frequently asked questions

What does well-formed mean?

Every tag is closed, tags are nested correctly, attributes are quoted and special characters like & are escaped.

Does it validate against a schema?

No, it checks that the XML is well-formed, not that it matches an XSD or DTD.

Is whitespace inside text kept?

Text is trimmed when beautifying. Use CDATA for content where whitespace matters.

Can I format an XML sitemap?

Yes, any XML document works.