HCODX/XML Diff
100% browser-based · Native DOMParser · Whitespace-normalized

XML Diff

Compare two XML documents in your browser. Both sides are parsed with the native DOMParser and re-serialized with consistent whitespace before line-diffing — so cosmetic differences don't muddy the output.

Before
After
Diff options
Open in JSON diff
Diff result
Left size
0 B
Right size
0 B
Changes
0
Status
Ready
Example

Structural compare for XML

Both sides are parsed and re-serialized with one element per line so the diff focuses on actual changes — not whitespace.

Before
<root>
  <item id="1">one</item>
  <item id="2">two</item>
</root>
Diff
  <root>
  <item id="1">one</item>
- <item id="2">two</item>
+ <item id="2">two-edit</item>
+ <item id="3">three</item>
  </root>
Use cases

What you'll use this for

Old-school but still everywhere — config files, SOAP envelopes, RSS feeds, sitemaps.

SOAP audit

Diff two SOAP requests or responses for protocol-level analysis.

Config-file changes

Compare two versions of an XML config (Spring, log4j, MSBuild) and see exactly what shifted.

Sitemap delta

Spot added or removed URLs between two crawls of your sitemap.xml.

RSS comparison

Compare two RSS or Atom feeds to find newly published items.

Step by step

How to diff XML structurally

1

Paste before

Drop the original XML into the left editor. Formatting differences are fine.

2

Paste after

Drop the modified XML into the right editor.

3

Keep normalize on

Both sides are parsed with DOMParser and re-serialized one element per line.

4

Copy or download

Save the unified-style diff as xml.diff for review.

FAQ

Frequently asked questions

Both sides are parsed with the native DOMParser and re-serialized with XMLSerializer, then split onto one element per line so the line diff doesn't trip over whitespace differences.

Attribute order follows whatever the browser DOMParser produces — generally document order. Attributes are not re-sorted, so an attribute reorder will show up as a change.

Yes. Completely free, no signup, no limits. Both documents stay in your browser.

You'll see "Left side XML parse error" or "Right side XML parse error" in the output. Either fix the input, or turn off normalize to fall back to a raw text diff. Try the XML Validator to localize the problem.

Click the swap arrows in the After header — it flips the two sides and re-runs the diff so additions and deletions switch roles.

About

About structural XML diffing

An XML structural diff ignores whitespace and serialization quirks that don't change the document's meaning. By normalizing through a real XML parser first, the diff focuses on what actually changed — elements, attributes, and text content.

How normalization works

  • Each side is parsed with the native DOMParser as application/xml.
  • If parsing fails, an inline error is shown.
  • The DOM is re-serialized via XMLSerializer.
  • A simple ><>\n< rewrite puts one element per line so the line diff is readable.

Limits

  • Attribute order is not sorted — reordered attributes appear as changes.
  • Mixed content (text + child elements) is preserved as-is by the serializer.
  • Namespace prefixes follow what the DOMParser emits.
Related

Related tools