Skip to content

XML Formatter

Format or minify XML, and check that its tags are balanced.

Mode

Runs in your browser — nothing you enter is sent to a server.

How the XML Formatter works

Paste XML and choose Format to indent every nested element on its own line, or Minify to remove the whitespace between tags. Elements that contain only text stay on one line, like <to>Ana</to>.

While formatting, the tool checks that every tag is closed in the right order and tells you where it isn't. XML declarations, comments, CDATA sections and processing instructions are kept as written.

Examples

Formatting

<note><to>Ana</to><!-- hi --><body>Hello</body></note> becomes:

<note>
  <to>Ana</to>
  <!-- hi -->
  <body>Hello</body>
</note>

A mismatched tag

<a><b></a> is reported as </a> closes <b> — tags must be closed in order, instead of being formatted wrongly.

Frequently asked questions

Does it validate against a schema?

No. It checks that the XML is well-formed — tags balanced and properly nested — but not against an XSD or DTD.

Does formatting change my data?

Only whitespace between tags. Text inside elements, attributes, comments and CDATA are kept. If whitespace in your text is significant, check the result before using it.

Can I format sitemaps, RSS feeds and SVG?

Yes — they are all XML. Minify SVG before inlining it, and format a sitemap to read it.

Is my XML uploaded?

No. It is formatted in your browser.

HTML Formatter

Beautify messy HTML with indentation, or minify it — keeping pre, script and style content intact.

Developer Tools

JSON Formatter

Format, validate and minify JSON, with the exact line and column of any error.

Developer Tools

Sitemap Helper

Turn a list of page URLs into a valid XML sitemap, with duplicate removal and URL checks.

SEO Tools