XML diff

Compare two versions of an XML document element by element. Attribute order and indentation never count, namespace prefixes and comments only when you say so, and every difference comes with its path and its line in both documents. Everything runs in your browser.

Also count

Original

Changed

The documents are the same, as far as the options above count.

How the documents are compared

Both documents are read as trees and compared from the root down. Attributes are compared by name, so their order never matters. Children are paired in order, elements by name, along the longest run the two documents have in common: an element inserted in the middle shows as one addition, not as everything after it changing. Text is compared with its whitespace collapsed.

What else counts is up to you:

Whitespace
Indentation and line breaks between elements, and spaces inside text.
Comments
Added, removed and changed comments.
Namespace prefixes
Off, <o:order xmlns:o="urn:example:orders"> and <order xmlns="urn:example:orders"> are the same element: only the namespace counts.
Order of elements
Untick it for documents whose order carries no meaning, such as a set of records: children are then paired by content.

Reading the result

Each difference says what changed (an element, an attribute, text or a comment), where, as an XPath, its value before and after, and its line in each document; click a line to jump to it. The editors mark the lines in their margins: changes in both, removals in the original, additions in the changed document.

When every byte counts

This tool ignores what XML treats as insignificant. A signed document (XML-DSig, XAdES) must stay identical byte for byte, so compare signed files with a line diff (git diff, diff) as well.

Questions

Is my XML uploaded?

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

Does attribute order count?

No, never: XML gives it no meaning, so neither does the comparison.

How large can the documents be?

Documents of a few megabytes compare in a moment. The comparison runs in your browser tab, so its memory is the limit; the first 1,000 differences are listed, all of them counted.

Can it compare a document with a schema?

No, document with document. To check a document against an XSD, DTD or RelaxNG schema, use the validator.

Other tools

  • XML formatter: Pretty-print or minify XML, keeping text, CDATA and comments as written.
  • XPath tester: Evaluate XPath 3.1 against a document and see each match with its line.
  • XSD generator: Infer an XML Schema from sample documents, checked against them.
  • XML from XSD: Generate a sample XML document from a schema, validated against it.
  • XSLT transformer: Run XSLT 1.0, 2.0 or 3.0 on a document and see the result, the messages and the files it writes.
  • XML to JSON converter: Convert XML to JSON, with arrays where an element repeats or wherever its XSD allows.
  • JSON to XML converter: Convert JSON to XML: @keys become attributes, arrays repeated elements.
  • XML to CSV converter: Turn a repeating element into CSV rows: invoice lines, products, records.
  • E-invoice viewer: Read an XRechnung, ZUGFeRD, Factur-X or Peppol invoice as a document, and print it.
  • XML validator: check a document against XSD, DTD, RelaxNG or Schematron, up to 1 GB.