DevToolbox

XML Diff — Compare Two XML Documents Line by Line

A git-style unified diff of two XML documents after both are re-indented consistently.

Loading tool…

This tool re-indents both XML documents with the same 2-space formatting, then diffs them line by line and shows the result like git diff: red lines for the original, green + lines for the change, with line numbers and context. Because both sides are normalised first, differences in the original indentation or line endings do not create noise.

Changed lines are highlighted down to the character. It is handy for comparing SOAP responses, two versions of a config file, or a build's output before and after a change. Nothing is uploaded — everything runs in your browser.

Features

  • git-style unified diff with +/− lines and line numbers
  • Both documents re-indented first, so formatting noise is removed
  • Character-level highlighting on changed lines
  • Collapsed context with hunk headers, or full-file view
  • Both inputs are checked for well-formedness first
  • Copy the result as a unified patch

How to use the xml diff

  1. Paste the first XML document on the left, the second on the right.
  2. The diff runs automatically once both sides are well-formed.
  3. Read the diff: − red is the original, + green is the change.
  4. Toggle full context, or copy the unified patch.

Frequently asked questions

Is this a text diff or a structural diff?

A text diff of re-indented XML. Both documents are reformatted with identical indentation first, so you get git-style output without whitespace-only noise, but element and sibling order still matter.

Will reordered elements show as a change?

Yes. Sibling elements are compared in document order, so moving one shows up as removed and re-added lines, the same way git would show it.

Are comments and CDATA compared?

Yes. They are kept by the formatter, so they appear in the diff like any other line.

Is my data private?

Yes. Both documents are parsed, re-indented and diffed entirely on your device.

Last updated September 10, 2026.

Related tools