XML Formatter & Validator

Last updated:

Paste XML, get it pretty-printed, minified, or validated with a line/column error pointer — all in your browser, nothing uploaded.

How it works

  • Format pretty-prints your XML with 2, 4, or 8-space indentation, checking that every tag is properly opened, closed, and matched, and that the document has exactly one root element.
  • Minify collapses it to a single line with no inter-tag whitespace — useful for shrinking a payload before pasting it somewhere space-constrained.
  • Invalid XML shows a specific error (mismatched tag, unclosed tag/comment/CDATA, missing or multiple root elements) with a line/column pointer, so you don’t have to eyeball a wall of tags to find the problem.
  • Attribute values, text content, comments, and CDATA sections are passed through exactly as written — nothing gets re-escaped, so & in your source stays & in the output instead of doubling up.

This is a lightweight well-formedness checker, not a full XML 1.0 validator — it doesn’t do schema (XSD/DTD) validation, namespace resolution, or entity decoding, and a DOCTYPE declaration with an internal subset isn’t parsed correctly. Runs entirely in your browser — nothing you paste here is uploaded, logged, or stored. There’s no autosave, by design, since XML pasted into a formatter can contain API keys or other sensitive data.

🔧 Also try: JSON Formatter →