XML Comparer
Compare two XML documents side by side and see every changed element, attribute, and value.
Beautify, minify, and validate XML online. Free, instant, and 100% in your browser.
XML (Extensible Markup Language) is used for SOAP APIs, RSS feeds, SVG images, office documents, Android layouts, Maven builds, sitemaps, and countless configuration files. Machine-generated XML often arrives on a single line, which makes it almost impossible to read or debug.
This XML formatter indents your document so its structure is clear, and checks it for syntax errors at the same time. When something is wrong, you see exactly where and why.
Checks well-formedness as you type: unclosed and mismatched tags, duplicate attributes, unescaped & and <, and more.
Every error shows its line and column with a clear explanation, and Go to error jumps straight to it.
Indent with 2, 3, or 4 spaces or tabs, or remove whitespace between elements to shrink the file.
Comments, CDATA, processing instructions, and DOCTYPE are kept. Mixed content and xml:space="preserve" stay exactly as written.
Format SOAP and WSDL messages, RSS and Atom feeds, SVG, Maven and Android files, sitemaps, and config files.
Everything runs locally in your browser. Your XML is never uploaded or stored.
<note priority="high"><to>Ada</to><from>Alan</from><body>See you at <b>noon</b>!</body></note><note priority="high">
<to>Ada</to>
<from>Alan</from>
<body>See you at <b>noon</b>!</body>
</note>
The <body> element mixes text and a child element, so it is kept on one line to preserve its exact text.
| Error | How to fix it |
|---|---|
| <a><b></a> | Close elements in the reverse order they were opened: <a><b></b></a>. |
| AT&T | Escape a literal ampersand as &, for example AT&T. |
| <item id=5/> | Wrap every attribute value in quotes: <item id="5"/>. |
| | HTML entities are not defined in XML. Use   or declare the entity in a DTD. |
| <a/><b/> | An XML document must have exactly one root element. Wrap both in a parent. |
| Text before <?xml ...?> | The XML declaration must be the very first thing in the file, with no spaces before it. |
An XML formatter rewrites XML with consistent indentation and line breaks so nested elements are easy to read. This tool also validates the XML and reports the exact line and column of any syntax error.
Well-formed XML follows the XML syntax rules: one root element, properly nested and closed tags, quoted attributes, and escaped special characters. Valid XML is also checked against a schema (XSD or DTD). This tool checks well-formedness, which is what every XML parser requires.
No. Only whitespace between elements is changed. Comments, CDATA sections, processing instructions, and the DOCTYPE are preserved. Elements that mix text and child elements, and elements with xml:space="preserve", are kept exactly as written because their whitespace can be meaningful.
XML only predefines five entities: <, >, &, ", and '. HTML entities such as or © are not part of XML unless they are declared in a DTD. Use numeric references like   instead.
No. Parsing and formatting run entirely in your browser using JavaScript. Your XML never leaves your device.
Compare two XML documents side by side and see every changed element, attribute, and value.
Convert JSON to well-formed XML with custom root and item names, attributes, and indentation.
Convert XML to JSON with attributes, repeated elements as arrays, and automatic number and boolean detection.
Convert XML documents and configs into clean, readable YAML.