How to compare two XML files
XML Diff compares Original (A) with Modified (B) as parsed XML trees. It reports differences in elements, attributes, namespaces, text, CDATA, comments, and selected XML declaration values. Processing instructions and document type nodes are not reported.
Whitespace-only text nodes are skipped. Leading and trailing whitespace is trimmed from collected text, CDATA, and comment values before comparison.
Compare XML files
- Select or paste the Original (A) and Modified (B) inputs. The file pickers accept XML and TXT files.
- Choose a matching mode; comparison runs automatically when both documents and any settings are usable.
- Review the result statistics for Added, Removed, Changed, and Total differences. These counts are calculated before filters are applied.
- Click Clear to reset the selected inputs and comparison state.
An empty input is rejected, and invalid XML produces a parse error for the affected document.
Choose a matching mode
- By document order (preserves sibling order) matches same-tag siblings by position. Moving a sibling is therefore reported as a difference.
- By identity attribute (order-insensitive) matches same-tag siblings by the selected attribute value when that attribute is present.
When using keyed matching, enter the attribute in Identity attribute name. Elements without that attribute fall back to positional matching. Use unique identity values within each relevant same-tag sibling set; duplicate values collide and are not safe for keyed comparison.
Review differences in Diff list
Diff list is the authoritative result view. Each entry includes the change kind, node type, XPath-like path, old value, and new value. Use the change-type and node-type filters to narrow the displayed entries. The filters also control which entries are included in JSON and CSV exports.
Use Side-by-side for context
Side-by-side renders indented element and content trees for context. Highlighting appears where a difference path maps to a rendered line. XML declaration entries are not rendered there, and attribute or namespace differences do not map to separate displayed lines for highlighting, so use Diff list for every difference type.
Export filtered differences
Use Export JSON or Export CSV to save the currently filter-matched differences. The exported fields are kind, node type, path, old value, and new value; unchecked filters exclude entries from the export.
Limitations and processing scope
The inspected workflow reads files with browser-side FileReader, parses them with DOMParser, and creates downloads with Blob. This page does not establish broader claims about site-wide uploads, accounts, privacy, security, file-size limits, performance, browser compatibility, or usage limits.
The comparison covers the reported element, attribute, namespace, text, CDATA, comment, and XML declaration values. Processing instructions and document type nodes are outside its reported scope. Attribute order is not treated as a difference.
Frequently Asked Questions
How is this different from a generic text diff?
A text diff compares XML line by line. XML Diff parses both documents as trees, so indentation, line wrapping, and attribute order do not create differences, while reported elements, attributes, text, CDATA, comments, and namespaces are compared by structure and location.
Does attribute order matter?
No. Attributes are matched by name rather than position, so reordering them within an element does not create a difference.
Does sibling element order matter?
Yes when By document order (preserves sibling order) is selected. With By identity attribute (order-insensitive), same-tag siblings use the value entered in Identity attribute name when present; missing attributes fall back to position, and duplicate values are unsafe.
Is indentation and whitespace ignored?
Whitespace-only text nodes are skipped. Leading and trailing whitespace is trimmed from collected text, CDATA, and comment values before they are compared.