XML Diff
Compare two XML documents side by side, ignoring formatting differences, and see every changed line.
Runs in your browser. Nothing is uploaded.
How to use the XML Diff
- Paste the original XML on the left and the changed version on the right, or press Load example.
- Both documents are normalised first, so differences in indentation, line breaks and attribute order don’t count.
- Read the highlighted lines. Added lines are green and removed lines red, with unchanged lines collapsed around them.
- Copy the differences as a unified diff for a ticket or review.
See what really changed
Comparing two XML files with a plain text diff is frustrating. If one was reformatted, every line looks different; if attributes were reordered by a tool, real changes hide among false ones. This diff parses both documents and rewrites them in the same canonical layout before comparing, so only meaningful differences remain.
Normalisation first
Both sides go through the same steps:
- Formatting: every element on its own line with the same indentation, so a one-line file and a pretty-printed one compare cleanly.
- Attribute order: attributes are sorted by name, because XML doesn’t give order any meaning.
- Comments: dropped from the comparison unless you want to see them.
- Whitespace in text: runs of spaces and line breaks inside text are collapsed, so re-wrapped values don’t show up as changes.
Each option can be switched off when those details matter to you.
A clear view of changes
Differences appear as a line-numbered table. Removed lines are marked with a minus, added lines with a plus, and long stretches of unchanged lines are collapsed so you can focus on what moved. The status line counts added and removed lines. Copy as unified diff gives you text you can paste into a code review, a ticket or an email.
Typical uses
Release reviews and audits both benefit from a diff that ignores noise.
Check what a deployment changed in a configuration file, compare an API response before and after an upgrade, review edits to a sitemap or feed, or confirm that a tool which “only reformats” really changed nothing.
Private
Both files stay in your browser, so configuration with hostnames, keys or customer data never leaves your device. To compare JSON, use JSON Diff; to tidy a single file, use the XML Formatter.
Frequently asked questions
Why do my files show no differences when the text differs?
Because the differences are only formatting. XML treats indentation between elements, attribute order and, with the option on, comments and extra spaces in text as insignificant, so the tool ignores them by default.
Does attribute order matter in XML?
No. XML parsers treat <a x="1" y="2"/> and <a y="2" x="1"/> as identical, so the tool sorts attributes before comparing. Untick Ignore attribute order if you need to see order changes, for example to keep a file tidy.
What if one of the documents is invalid?
The comparison needs both to be well-formed. The message names the side with the problem, describes it and highlights the position in that editor.
How large can the files be?
Documents of several megabytes compare quickly. Extremely different files fall back to showing a block replacement rather than a slow line-by-line search.
Are my files uploaded?
No. Both documents are compared in your browser.
Tutorials
How to compare two XML configuration files
Find the real differences between two versions of an XML config, even when one was reformatted and its attributes reordered.