General dev

XML Formatter

Runs locally

Use XML Formatter

What it does

Pretty-print or minify an XML document such as a sitemap, an RSS feed or an SVG file; malformed XML is reported with the parser error message.

It runs entirely in your browser: nothing you enter is uploaded.

Example

One-line sitemap

Input
<?xml version="1.0" encoding="UTF-8"?><urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"><url><loc>https://example.com/</loc><priority>0.8</priority></url></urlset>
Output (captured 2026-10-20)
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
  <url>
    <loc>https://example.com/</loc>
    <priority>0.8</priority>
  </url>
</urlset>

The XML declaration stays on the first line, and the url, loc and priority elements are indented by two spaces per level.

FAQ

Does it validate against a schema?

No. It checks that the document is well-formed (tags closed and nested correctly, one root element, attribute values quoted) using the browser's DOMParser. DTDs and XSD schemas are not checked.

Can formatting change the document?

Whitespace between tags is removed and replaced by new indentation, which matters for mixed content and xml:space="preserve". Comments, a DOCTYPE or CDATA sections also push the indentation of the following lines one level to the right.

Is the XML uploaded?

No. Parsing and formatting run in your browser, and the document is not sent anywhere.