XML Formatter & Validator

Beautify, minify and validate XML. Everything runs in your browser.

Result appears here…
Advertisement

What this tool does

This tool checks that your XML is well-formed, then re-prints it with clean indentation (format) or strips whitespace between tags (minify). If the XML has an error, it shows the message so you can fix it.

Example

The compact <root><item>Hi</item></root> formats into an indented, readable tree. Minifying reverses it.

Common XML rules

  • Every opening tag needs a matching closing tag (or be self-closing like <br/>).
  • There must be exactly one root element.
  • Attribute values must be quoted.
  • Special characters like & and < must be escaped.

How to fix common errors

  • “Opening and ending tag mismatch”: check that every tag is closed in the right order.
  • “Extra content at the end”: you likely have more than one root element — wrap everything in a single root.
Advertisement