XML diff tool macOSWindows

Compare XML without letting formatting hide the real changes

Compare XML files locally by parsed elements, attributes, and text, with stable navigation, review states, and Pro saved profiles and exportable reports.

Direct answer

Does Diff Anything compare XML as text or structure?

Diff Anything compares parsed XML structure so indentation or other presentation-only changes do not overwhelm the result. Repeated elements are matched by a key attribute such as id or name, and each difference is located with a readable XPath. Pro can retain review state and notes in saved profiles and export the result without uploading the documents.

Diff Anything comparing two JSON files, with user records matched by id and a changed role value selected
Semantic mode lists changed paths and values. Here a Compare by id rule matches user records, so a reordered list shows only the real changes. View full size

What is compared

Elements, attributes, and text, without layout noise.

Pretty-printing an XML file or reordering an element's attributes changes many lines of text but none of the content. Diff Anything reads both documents as elements, attributes and text, so indentation between elements and attribute order do not count as changes.

Text inside each element is trimmed, and whitespace-only text between elements is ignored. CDATA sections are compared as part of the element's text. Namespaces are compared by URI, so a document that uses a different prefix for the same namespace is not reported as changed.

Each difference is listed with a readable XPath location that uses the document's own prefixes, for example /catalog/@version for an attribute of the root or /catalog/m:item[@id="1"]/text() for the text of a keyed element.

Matching elements

Repeated elements are matched by name and key attribute.

Child elements are matched by their name and the first key attribute they have: id, key, name, code, ref or uuid, as in item[@id="1"]. Children without a key attribute are paired in order by name. An inserted or removed child is reported as added or removed, so the siblings after it are not shifted. When keyed children only moved, the result reports that the child elements were reordered.

If child order does not matter for a particular element, open Unordered elements and add its path as the document writes it, for example /root/items. Its children are then paired regardless of order, so a different order is not a change. This applies only to elements with no mixed text content.

XML opens in the Tree view, which shows both documents side by side. The Semantic tab lists every difference, and the Raw tab shows the two documents as written.

Boundaries

Comments and custom entities are outside the comparison.

XML comments, processing instructions, and the DOCTYPE are not compared. The predefined entities (&, <, >, ", '), numeric character references, and entities declared in the document's DOCTYPE are expanded, in text and attribute values. Undeclared, parameter and external entities, and entities whose text contains markup, stop the comparison with an unsupported-entity error. Nothing is fetched from outside the file.

Copying a change into an XML file rewrites the document from its elements. The confirmation says so before anything changes: the declaration, anything around the root element, and the document's own namespace prefixes are kept, but comments inside the root and indentation are not.

SVG files open in XML mode, so you can compare the markup of two graphics. To compare how two images look, use the Binary / Image mode with PNG or JPEG exports.

Size and plans

How large a document it handles, and what Pro adds.

One comparison reads documents of up to 500,000 elements, nested up to 256 levels. A larger or deeper document is reported as an error instead of being compared in part.

The free plan shows the complete XML result in the app for files up to 5 MB each, with 10 comparisons per day. Pro removes the 5 MB limit and adds saved profiles that keep your Unordered elements paths, comparison history, and HTML, JSON, or Markdown reports.

Best for

Where this workflow fits.

  • Large configuration or data documents with formatting churn
  • Private XML files that cannot be pasted into an online tool
  • Repeatable reviews that need retained sources, mode, review states, and notes

No accounts, cloud comparison service, analytics, or telemetry.

Relevant capabilities

What Diff Anything brings to the job.

Practical workflow

From setup to a reviewed result.

  1. Open both XML documents

    Choose the files or paste the markup. Auto opens XML and SVG files in XML mode.

  2. Review the result

    Start in the Tree view to see both documents side by side, or open the Semantic tab for the list of changed elements, attributes and text.

  3. Handle order-free lists

    Add paths under Unordered elements for lists where sibling order has no meaning.

  4. Follow each location

    Use the XPath location of each difference to find the element, attribute or text that changed.

Useful in practice

Direct answers

Questions about XML diff tool.

Does Diff Anything compare XML as text or structure?

Diff Anything compares parsed XML structure so indentation or other presentation-only changes do not overwhelm the result. Repeated elements are matched by a key attribute such as id or name, and each difference is located with a readable XPath. Pro can retain review state and notes in saved profiles and export the result without uploading the documents.

Does XML comparison ignore attribute order?

Yes. Attributes are compared by name, so the same attributes in a different order are equal.

Are namespace prefixes compared?

No. Elements and attributes are compared by namespace URI. Two documents that bind the same URI to different prefixes compare as equal.

Are repeated elements matched by an id attribute?

Yes. Repeated elements are matched by name and the first key attribute they have: id, key, name, code, ref or uuid. Elements without one are paired in order. For lists where order does not matter, add the parent's path under Unordered elements.

Can I compare XML from the command line?

Yes, with Pro. The free command line compares text and JSON only.

Go deeper

Choose sources, understand automatic detection, and select the engine that answers the question you are actually asking.

Read Choose the right comparison mode
Free & Pro: what’s included

Available on the Mac App Store and Microsoft Store. Free desktop use lets you try every comparison engine for files up to 5 MiB per side and 10 new comparison sessions per local day; collection previews show the first 100 items and PDF previews show the first 3 pages. The free CLI supports text and JSON. A one-time Pro purchase removes the preview and session limits and unlocks larger sources within technical limits, saved profiles and history, report export, three-way merge, folder synchronization, batch manifests, trusted preprocessors, and every CLI mode.

More Diff Anything

Browse every focused tool and workflow.

See all Diff Anything tools