TinyTools

XML Compare & Diff

Use this XML compare tool to find differences between two XML documents. Compare them structurally or as text, identify added, removed and changed elements, and optionally ignore formatting differences such as indentation or attribute order.

100% In-Browser Privacy
Original XML
Modified XML
Diff Summary: 0 Added 0 Removed 0 Changed
Paste XML in both panes and click "Compare XML Documents" to view element-level differences.

How to Compare Two XML Files

To compare two XML documents online, paste the original document in the left pane and the revised version in the right pane (or upload your .xml files). Click Compare XML Documents to analyze differences.

The tool parses both files using the browser's native DOM parser. Added elements appear in green, removed elements in red, and modified values or attributes in amber with exact XPath locators.

XML Structural Diff vs Plain Text Diff

Comparing XML files as plain text frequently produces false alarms. In standard XML:

  • Attribute ordering does not alter document meaning (<user id="1" role="admin"> is semantically identical to <user role="admin" id="1">).
  • Whitespace and indent levels between tags are generally non-semantic formatting.

A standard line diff flags those as changes. TinyTools Structural XML Diff parses the actual Document Object Model tree, comparing nodes, attributes, and text values logically rather than line-by-line.

Ignoring Whitespace and Attribute Order

You can toggle options to match your exact testing scenario:

Ignore Whitespace

Collapses insignificant carriage returns, tabs, and indentation between tags.

Ignore Attribute Order

Treats attributes as unordered key-value sets matching W3C XML specifications.

Ignore Comments

Suppresses <!-- comment --> nodes from diff calculations.

Understanding XML Diff Results & XPath Locators

When differences are found, TinyTools generates an XPath-style locator showing where each change occurred in the document tree. For example:

[CHANGED] /catalog/book[2]/price : "$29.95" → "$34.95"

This allows you to quickly locate specific properties in large configuration files, SOAP XML payloads, or export manifests.

Privacy & Data Security

All XML parsing, normalization, and diff comparisons occur 100% locally in your web browser using the browser's built-in DOMParser API. Your configuration files, database exports, and proprietary data are never uploaded, cached, or transferred over any external network.

Related Developer Tools

Frequently Asked Questions

Can I compare two XML files online?

Yes. You can paste XML strings or upload local .xml files to view structural differences directly in your browser.

Does attribute order matter in XML?

Under the W3C XML standard, attribute ordering is not semantic. Our tool ignores attribute ordering by default so reordered attributes are not falsely flagged as changes.

Can I ignore whitespace?

Yes. With "Ignore Whitespace" enabled, differing line breaks, indentation levels, and extra spaces between tags are normalized before comparison.

What happens if my XML is invalid or malformed?

The tool detects parser errors using DOMParser and displays the exact parser error message beneath the affected input box so you can fix the syntax before diffing.

Built and maintained by TinyTools. Compliant with W3C XML 1.0 recommendations. Last reviewed: September 2026