XML Diff — Compare Two XML Files
Compare two XML documents by structure. Attribute order and indentation stop counting as differences, and repeated elements are matched by content rather than position.
Left XML
Right XML
Diff
About this tool
XML documents carry a lot of noise that a text diff cannot tell apart from meaning: indentation, attribute order, line wrapping inside a tag. This page parses both sides — attributes become @-prefixed keys, repeated elements become arrays — and compares the structures. What comes back is the difference in the data: a value that changed, an element that appeared, an attribute that went away.
How to use it
- 1Paste the two XML documents into the left and right panels.
- 2Read the result as Split, Tree or List, and use the arrows to step through the changes.
- 3Turn on Changes only to collapse the untouched parts.
Frequently asked questions
›How are attributes compared?
As data, on the element that carries them — they appear in the result as @-prefixed keys. Reordering attributes on an element produces no difference, because attribute order carries no meaning in XML.
›Does whitespace between elements matter?
No. Indentation and line breaks between elements are parsed away, so reformatting a document gives an empty diff. Whitespace inside a text value is preserved and does count.
›What happens with repeated elements?
Two or more sibling elements with the same name become an array, and arrays are matched by content — so removing one entry from a long list is reported as a single removal, not as everything after it having shifted.
›Are comments and processing instructions compared?
No. Neither survives parsing, so changing a comment shows nothing here. The same goes for the XML declaration.
›What if one side is not well-formed?
The comparison stops and the status bar names the side and the line, with a link that focuses that panel. Nothing is compared half-parsed.