Tools
EN

Compare XML Files

Paste or drop two XML documents to see what changed. Both sides are formatted the same way before the comparison, so only real differences in elements, attributes and text are shown – side by side.

Original XML

Changed XML

Private: your data is processed in your browser and never uploaded.

How to compare two XML files

  1. Paste or drop the original XML on the left and the changed XML on the right. The result updates as you type.
  2. Choose what to ignore: whitespace in text, comments or attribute order. Hide unchanged lines keeps long documents short.
  3. Read the summary of added, removed and changed lines, then go through the side-by-side view. Swap sides reverses the direction.

What the XML diff ignores

DifferenceIgnored
Indentation and line breaks between elementsAlways
Single or double quotes around attribute valuesAlways
<a/> or <a></a>Always
Extra spaces and line breaks inside textWith Ignore whitespace in text (on by default)
CommentsWith Ignore comments
Order of attributesWith Ignore attribute order (on by default)
Order of elementsNever – a moved element shows up as removed and added
Namespace prefixes, &amp; or &#38;, CDATA or escaped textNever – they are compared as written

How the comparison works

Both documents are parsed, normalized with the selected options and written out with the same two-space indentation. The resulting lines are compared with the Myers diff algorithm, the method that git diff uses by default. Replaced lines are paired up as changed lines, and long runs of unchanged lines can be folded away. Because the result refers to these formatted versions, line positions can differ from your original files.

Frequently asked questions

Does the order of elements matter?

Yes. Elements in XML are ordered, so a moved element appears as removed in one place and added in another. Only the order of attributes can be ignored, because it carries no meaning in XML.

Why are two files different although they look the same?

Check the options: comments, attribute order and whitespace inside text count as differences when the matching option is off. Namespace prefixes and entity spellings such as &amp; and &#38; are also compared exactly as written.

Can I compare XML that is not well-formed?

No. Both documents have to be parsed first. If one of them has an error, it is shown under that side with its line and column – fix it there or in the XML validator.

Is my data uploaded?

No. The comparison runs in your browser, and nothing is sent to a server.