XML Compare & Diff
Compare two XML documents side by side by structure and XPath, ignoring formatting noise, comments, or attribute order.
Comparison options
Formatting, indentation, and self-closing vs empty tags never count as changes. Differences are keyed by XPath, and sibling elements with matching id or name attributes are paired so edits inside a record show at the changed field.
Paste two XML documents, open two files, or load the example. To check one document for syntax errors first, use the XML validator.
How to Compare Two XML Files
Paste or drop the original XML into the left editor and the modified XML into the right editor, or click Open file on either panel. Both sides are validated for XML well-formedness first; if either side has a syntax error, its exact line and column are shown with a Jump to error button. When both documents parse, every added, removed, and changed element, attribute, or text value appears in the XPath diff list below.
What Counts as Equivalent vs Changed
Formatting whitespace between tags, XML declaration formatting, and empty-element syntax (<a/> vs <a></a>) never trigger noise. Use the checkboxes above the editors to control whether XML comments, attribute ordering, and child element ordering are ignored.
| Input | Output | Note |
|---|---|---|
| <a x="1" y="2"/> vs <a y="2" x="1"/> | Equivalent (default) | Attributes are unordered in XML |
| <empty/> vs <empty></empty> | Equivalent | Same Infoset element |
| <!-- note --> removed | Ignored by default | Uncheck Ignore comments to diff |
| <price currency="USD">44.95</price> -> 49.95 | Changed at /.../price | Exact XPath reported |
Common Use Cases
Developers compare XML files when reviewing SOAP API contract changes, auditing Maven pom.xml or .NET .csproj diffs, checking RSS/Atom feeds and sitemaps after deploys, verifying EDI and financial XML exports, or comparing Android layout and manifest updates.
Frequently Asked Questions
How is structural XML comparison different from a plain text diff?
A plain text diff flags re-indented lines, self-closing tags written as <empty/> vs <empty></empty>, and attributes written in a different order. This tool parses both documents into XML trees first, so only real changes to elements, attributes, text values, or comments are reported—each keyed by its exact XPath.
Does attribute order count as a difference?
By default, no—under the W3C XML specification, attributes on an element are an unordered set. Uncheck "Ignore attribute order" if you need to check canonicalized XML or confirm that a serializer preserved exact attribute ordering.
Can I ignore child element order when comparing XML?
Yes. Leave "Ignore child element order" unchecked for ordered records such as SOAP bodies, documents, or RSS feeds. Turn it on when comparing configuration files or exports where sibling elements can appear in any order.
How are edited sibling elements matched?
When sibling elements share the same tag name and an identity attribute such as id, name, key, or code, the comparator pairs them before recursing. Changing the price inside <book id="bk102"> therefore reports one change at /catalog/book[2]/price instead of deleting and re-adding the entire book.
Is my XML uploaded to a server?
No. Parsing, validation, and comparison run locally in your browser tab using JavaScript. Both XML files stay in browser memory, and nested DOCTYPE entities ("billion laughs" payloads) are refused before expansion.
Continue with the data, not the directory
Validate, format, repair, compare, query, and reshape payloads before they ship.
XML Viewer
Open an XML file as a collapsible tree, search elements, attributes and text, and copy the XPath of any element.
XML Formatter
Indent and beautify XML without rewriting your document - comments, CDATA, and attribute order are preserved.
XML Validator
Check XML well-formedness and get the exact line and column of the first error.
JSON Compare & Diff
Compare two JSON documents side by side, with changed lines highlighted, counts of what was added, removed and changed, and an option to ignore array order.