Advertisement

XML Compare Online 2026 - Diff Two XML Files Side-by-Side

Compare two XML files side-by-side. Identify differences in elements, attributes, and values with clear visual highlighting. 100% Private & Free.

Key Features

  • Side-by-side recursive diff
  • Visual difference highlighting
  • Namespace awareness
  • Ignore attribute order option
  • Client-side only

How to Use

  1. Paste the original XML in the left panel
  2. Paste the modified XML in the right panel
  3. The tool automatically highlights differences
  4. Green indicates added content
  5. Red indicates removed content
  6. Yellow indicates changed values or attributes
  7. Use the "Format" option to normalize indentation before comparing

Expert FAQ

  • One file wraps a value in <![CDATA[...]]> and the other has the identical text without the CDATA wrapper — flagged as a difference?
    No — CDATA is purely a syntax escape that tells the XML parser "don't interpret markup characters in here," not a distinct data type. Both forms parse to the exact same text node, so a value written as <desc><![CDATA[Terms & Conditions]]></desc> and one written as <desc>Terms &amp; Conditions</desc> are compared as identical content, since by the time either reaches the diff they're just the string "Terms & Conditions."
  • Does a different XML declaration (encoding="UTF-8" vs encoding="UTF-16", or one file having a DOCTYPE and the other not) register as a diff?
    No — the prolog and any DOCTYPE declaration are document metadata, not part of the element tree, so they're excluded from the structural comparison entirely. Changing the declared encoding without changing any actual decoded character produces no diff; what would produce a diff is if the encoding change caused characters to actually decode differently (e.g. a byte sequence that's valid UTF-8 but different text under Latin-1).
  • Can I compare two SOAP payloads or XML config files containing customer PII or credentials without that data leaving my browser?
    Yes — this is a common real use case (diffing two versions of a WSDL-generated request while debugging an integration), and the entire comparison runs in your browser's JavaScript engine. Neither document nor the computed diff is sent to any server, so pasting in payloads containing account numbers, tokens, or other sensitive fields doesn't expose them beyond your own machine.
  • One file uses <empty/> and the other uses <empty></empty> — are those flagged as different?
    No — both are parsed to the same DOM representation (an element with no children), since they're defined by the XML spec as equivalent serializations of the same thing. The diff operates on the parsed tree, not the raw text, so this kind of pure-syntax variation never produces a false positive the way a text-level diff would.
  • Two elements use different namespace prefixes for the same namespace URI (ns1:Item vs soap:Item, both bound to the same xmlns) — same or different?
    The comparison resolves prefixes to their bound namespace URI before comparing element identity, so ns1:Item and soap:Item are treated as the same element if both prefixes map to the same URI via their respective xmlns declarations — comparing raw prefix strings would produce a false diff every time two documents simply chose different (but equivalent) prefix names, which is extremely common across tools that generate the same SOAP schema.

Technical Details

Diffing XML well requires resolving several places where two documents can be byte-different but semantically identical. Attribute order within a tag carries no meaning per the XML spec, so attributes are compared as an unordered set rather than position-by-position. Self-closing (<empty/>) and explicit-empty (<empty></empty>) forms of the same element parse to an identical DOM node and are never reported as a diff, since the choice between them is purely a serialization preference with no semantic content. Whitespace-only text nodes between sibling elements in "data-style" XML are also normalized away before comparison, so re-indenting a file (running it through a formatter, for instance) doesn't itself generate spurious diff noise. Namespace handling is resolved semantically rather than textually: two elements using different prefixes that are both bound, via their respective xmlns declarations, to the same namespace URI are treated as the same element. This matters in practice because different tools generating XML against the same schema (SOAP clients, WSDL-derived serializers) frequently choose arbitrary, inconsistent prefix names for an identical namespace — a naive text diff would flag every element as changed purely because of prefix bikeshedding, even when nothing about the actual data changed. What the diff does treat as a real, reportable difference: element and attribute values, the presence/absence of an element or attribute, and mixed-content text order. For debugging large configuration or SOAP payload diffs, normalize both sides with the XML Formatter first if you want a clean visual reference alongside the structural diff.

Advertisement