XML formatter and validator

Beautify or minify XML and check that it is well-formed, keeping comments and CDATA. Works for sitemaps, feeds and configs. Runs in your browser.

Runs in your browser. Nothing you paste is uploaded. Also checks that the XML is well-formed.

How to use it

  1. Paste your XML.
  2. If it is well-formed, the formatted version appears on the right; if not, you see the parser's error.
  3. Choose 2 or 4 spaces, tabs, or Minify to remove all formatting.
  4. Copy the result or download it as an .xml file.

Pretty-print and check XML

XML is still everywhere: sitemaps, RSS feeds, Android layouts and manifests, Maven and .NET project files, SOAP APIs, e-invoices and government data exports. When it comes as one long line it is almost impossible to read. The formatter puts each element on its own line and indents children under their parents, keeping short elements like <name>Asha</name> on one line.

Before formatting, the XML is parsed with your browser's own XML parser, so this is also a well-formedness check: an unclosed tag, a stray & or mismatched quotes are reported. Comments, CDATA sections, processing instructions and the <?xml?> declaration are kept.

Minify

Minify removes the whitespace between tags to make files smaller for sending or embedding. Text inside elements is trimmed, so don't minify documents where leading or trailing spaces in text matter. This tool checks that XML is well-formed; it doesn't validate it against an XSD or DTD.

Questions

What does well-formed mean?
Every tag is closed, tags are properly nested, there is one root element, attribute values are quoted and special characters like & are escaped.
Does it validate against a schema?
No, it checks well-formedness only, not XSD or DTD rules.
Can I format a sitemap.xml?
Yes. Open the sitemap in your browser, view the source, copy it and paste it here.
Is what I paste sent to a server?
No. The tool runs as JavaScript in your browser. Your text, files and keys stay on your device, so it is safe to use with internal data, tokens and customer records. It keeps working offline after the page has loaded once.

More free tools