Developer

XML formatter

Indent and validate your XML, errors flagged.

  • Instant
  • Free
  • Private (processed locally)
  • No sign-up
Result

Read an XML at a glance, and know if it’s correct

XML received from an API or exported from software often arrives on a single line. This tool indents it hierarchically — one element per level — and, at the same time, checks it is well-formed with the browser’s XML engine.

  1. Paste the XML

    Compact, multi-line, badly formatted — whatever.

  2. Format

    Hierarchical indentation appears, as does the validity status.

  3. Read the status

    Valid XML in green, or a precise error message in red.

Common errors detected

  • Unclosed tag: without .
  • Bare ampersand: & instead of & in a value.
  • Several root elements at the same level.
  • Inconsistent case: closed by .

“Well-formed” validation via DOMParser: covers nearly all syntax errors. Conformance to a specific XSD schema is not checked. Everything stays local, nothing is sent.

Frequently asked questions

How does validation work?

The tool uses DOMParser, the browser’s built-in XML engine — the same one that reads RSS feeds or SVGs. If it detects an error (unclosed tag, forbidden character, multiple roots), it flags it with a message; otherwise your XML is validated.

What’s the difference between well-formed and valid XML?

“Well-formed” means the syntax is correct: tags closed, nesting respected, a single root element. “Valid” in the strict sense adds conformance to a schema (DTD, XSD). This tool checks “well-formed”, which covers the vast majority of common errors.

Why is my XML rejected when it “works”?

HTML tolerates a lot of laxity (unclosed tags, free case), XML does not. A single <br> without /, a bare & instead of &amp;, or two root elements is enough to make it invalid. The error message points to the cause.

Are attributes and order preserved?

Yes: indentation is purely visual. Tags, attributes, values and their order stay identical — only the whitespace between elements is reorganised for readability.