// IT TOOLS & CALCULATORS
| 100+ TOOLS
📄 XML FORMATTER & VALIDATOR100% Free
// Validate, prettify and minify XML — identify syntax errors instantly
ADVERTISEMENT
[ IN-CONTENT AD ]

XML Formatter / Validator

Paste in minified, hand-edited or machine-generated XML and get back something indented and readable, with the actual parser error pointed out when something's wrong — not just "invalid document" with no location. Works the other way too: collapse formatted XML down to a single compact line when you need it minified for transport.

How validation actually works here

This tool hands your document to the browser's own DOMParser rather than guessing at syntax with regular expressions, so the error message is the same one the parser itself would surface — a real, specific parse failure rather than a heuristic guess. That covers the errors that actually break an XML document: unclosed tags, mismatched tag names, malformed attributes, invalid characters, and a document with more than one root element.

Common ways XML breaks

  • A mismatched closing tag — <item>...</Item> — XML is case-sensitive, so item and Item are different tag names as far as the parser is concerned
  • An unescaped & in text content — it has to be written as &amp;, or the parser reads it as the start of an entity reference and fails
  • More than one root element — a well-formed XML document can only have a single top-level element wrapping everything else
  • Unquoted or mismatched-quote attribute values — id=1 or id="1' both fail; attribute values always need matching quotes
  • A self-closing tag missing its slash, or a slash placed incorrectly — <br> is valid in HTML but not in strict XML, which needs <br/>

Where XML still shows up

JSON displaced XML for most REST APIs and application config, but XML hasn't gone anywhere in the domains that needed its stricter structure and schema validation from the start: SOAP web services, SVG and RSS/Atom feeds, Office Open XML documents (the format underneath .docx and .xlsx), Android layout files, Maven's pom.xml, and most enterprise system-to-system integration built before JSON became the default. Anywhere a document needs a formally verifiable schema (XSD) or mixed text-and-markup content, XML is still usually the right tool rather than a legacy one.