Pro Calculators and Guides

How to Format, Indent and Minify XML and Check That It Is Well-Formed

Make XML readable with indentation, remove spaces to minify, and get a clear error if a tag is not closed properly.

Saizul Amin
Saizul Amin15 Oct 2026 · Updated 17 Oct 2026 · 1 min read
How to Format, Indent and Minify XML and Check That It Is Well-Formed

XML is used in sitemaps, RSS feeds, configuration files, office documents and many APIs. A single missing closing tag can break a whole file, and unformatted XML is hard to read.

Quick answer

Paste XML and choose Format to see it indented, or Minify to remove the spaces between tags. The tool also checks that the XML is well-formed and reports the error if a tag is not closed.

Well-formed XML needs

  • One root element.
  • Every opening tag has a matching closing tag.
  • Tags are properly nested.
  • Attribute values are in quotes.
  • Special characters are escaped: &, <, >.
  • Tag names are case-sensitive.

Example

<note>
  <to>Rahim</to>
  <from>Karim</from>
  <body>Meet at 5 pm</body>
</note>

Steps

  1. Paste your XML.
  2. Pick 2 spaces, 4 spaces or a tab for indentation.
  3. Press Format or Minify.
  4. Read any error message and fix it in your source.

Tips

  • Minify for smaller files in production; format for reading and editing.
  • Validate against a schema (XSD) if your system requires it; this tool checks syntax only.
  • Check the encoding declaration (<?xml version="1.0" encoding="UTF-8"?>) for Bangla and other scripts.
  • For JSON instead of XML, use the JSON Formatter or JSON to XML converter.

Your data stays in the browser.

Completely freeNo cost, no sign-up
Files stay privateEverything runs in your browser
Easy in your languageAvailable in many languages