ToolLineup

XML Diff & Compare

This XML diff compares two documents by structure rather than by text, so differences in indentation, line endings and attribute order are not reported — only the content that actually differs. That is the difference between a useful XML comparison and a text one: reformatting a file changes every line to a text diff and changes nothing here. Each difference is reported with the path where it occurs and both values, classified as added, removed or changed. Both documents are validated first, so a truncated file is reported as broken rather than silently compared as merely different.

How it works

Compares two documents by structure rather than by text, so differences in indentation, line endings and attribute order are not reported. Only the content that actually differs is listed.

That is the difference between a useful XML diff and a text diff: reformatting a file changes every line to a text diff, and changes nothing here.

Everything runs in your browser — nothing you paste is sent to a server.

Original document
Paste XML…

Nothing to parse yet.

Changed document
Paste the other version…

Why structural comparison

Run two XML files through a formatter with different settings and a text diff will report every line as changed while the documents are identical. Conversely, a single changed value buried in a long line can be easy to miss.

Comparing the parsed structure removes the noise entirely. What is reported is what differs.

What counts as a difference

  • Added — an element or attribute present only in the second document.
  • Removed — present only in the first.
  • Changed — present in both with a different value.

What is ignored

  • Indentation and line breaks between elements.
  • The order of attributes on an element.
  • Windows versus Unix line endings.
  • Whether an empty element is written as a self-closing tag or a pair.

Element order is significant and is compared, because in XML it carries meaning.

Frequently asked questions

How is this different from a text diff?

A text diff reports every line that changed, so reformatting a file makes it useless. This compares the parsed structure, so only genuine content differences appear.

Does attribute order matter?

No. Attribute order carries no meaning in XML, so two documents differing only in attribute order compare as identical.

What about whitespace between elements?

Ignored. Indentation and line endings are formatting rather than content.

What does the path column show?

Where in the structure the difference occurs, using dotted notation with array indices — so you can find it in the source quickly.

What if one document is malformed?

It is reported as invalid, against the correct panel. Comparing a truncated document as merely "different" would be misleading.

Is my data uploaded?

No. Both documents are parsed and compared in your browser.

Related tools