XML Diff: Compare Two XML Files Online

Original XML
Changed XML

Paste, format, and compare two XML documents side-by-side. Pretty-print, minify, and live well-formedness checks built in.

What is the XML diff tool?

This XML diff compares two XML documents in your browser and marks every changed tag, attribute and text node. Load the pom.xml from before the dependency bump on the left and the bumped one on the right. Neither file leaves your machine unless you press Share.

The diff itself is character-level, and validation goes through the browser's native DOMParser. The Format button on each pane reflows your XML with consistent indentation. Live validation flags malformed markup, mismatched tags, and broken entity references as you type.

If you have ever opened a 4,000-line Spring application context in a code review and tried to find the one bean whose class attribute changed, paste the two revisions here and that attribute is the line that turns red and green. For plain prose, use the main page to compare two texts. For structured data with key/value pairs, JSON diff handles object reordering more cleanly than XML can.

How the comparison works

Matching lines are paired up first. Inside each edited line the comparison goes character by character, and a cleanup pass nudges the highlight onto tag names, attribute values and text content instead of a stray angle bracket. Added text is green on the right, removed text red on the left.

XML has a few quirks the spec calls out, and they all bite when you compare two files as text. The XML 1.0 specification says attribute order on an element is not significant, so <img src="a.png" alt="x"/> and <img alt="x" src="a.png"/> are the same to a parser. A text diff will still flag the swap. The Format button here keeps attributes in the order they were written, so it will not hide the swap. The practical workaround is to canonicalise both files first (xmllint --c14n sorts attributes) and paste the output.

Namespaces add another layer. Two documents that bind the same URI to different prefixes are equivalent under Namespaces in XML 1.0, but a text diff will paint every ns1: vs ns2: swap as a change. Format both sides, fix the prefix in one of them, then re-diff. For a transformation pipeline that normalises namespaces and attribute order before diffing, look at XSLT 3.0 or a canonicalisation step per Canonical XML.

How to compare XML in three steps

No signup needed. The compare happens in the page itself, so your XML never touches a server.

  1. 1

    Paste or upload your XML

    Paste the old XML on the left and the new XML on the right, or use Upload above each pane to load a .xml, .pom, .config, or .svg file directly. Sample loads two versions of a short pom.xml.

  2. 2

    Format both sides for a fair comparison

    Click Format on each pane to pretty-print with consistent indentation and line breaks. This evens out the whitespace between tags so the diff highlights real content changes. Windows CRLF and Unix LF line endings need no work; the editor already reads them as the same line break. The validation badge turns green when DOMParser accepts your document as well-formed.

  3. 3

    Read the diff

    Red on the left is what the new file dropped; green on the right is what it added. The panes scroll together, and the count in each header adds up the edits across element names, attribute values and text content.

Where an XML diff saves time

Reviewing pom.xml dependency upgrades

A Dependabot PR bumps fifteen Maven coordinates at once. Paste the old pom.xml against the new one to confirm the actual upgrades: spring-boot-starter-web moved from 3.1.5 to 3.2.1, jackson-databind from 2.15.3 to 2.16.0, and a new micrometer-registry-prometheus dependency was added. The diff makes the version bumps obvious so you can sanity-check the changelog before approving.

Diffing Spring application context XML

When a service starts failing after a refactor, the cause is often a single bean whose class attribute or constructor argument changed in applicationContext.xml. Paste the working revision against HEAD; the diff surfaces the swapped class="com.acme.OldDataSource" vs class="com.acme.HikariDataSource" instantly, and the surrounding <property> tags tell you what configuration moved with it.

Comparing SOAP request and response bodies

A SOAP integration that worked yesterday returns a Fault today. Capture both envelopes from your packet logger or WireMock recordings, drop them into the diff, and the offending element jumps out: a <currencyCode> that switched from USD to a missing element, or a namespace declaration on the soap:Envelope that the upstream service quietly changed. Without a side-by-side view, finding this in 800 lines of XML is hopeless.

Auditing AndroidManifest.xml permissions

Before shipping a release, diff AndroidManifest.xml against the previous tag to catch permission creep. A new <uses-permission android:name="android.permission.READ_CONTACTS"/> that snuck in with a third-party SDK update is exactly the kind of thing the Play Store will flag at review time. The diff also surfaces changes to <intent-filter> elements and android:exported flags, which are common security review focus areas.

Tracking RSS or Atom feed schema changes

A feed reader breaks because the source switched from RSS 2.0 to Atom 1.0, or a publisher added a new <media:thumbnail> namespace. Save a snapshot of the working feed, diff it against the live one, and the structural change is right there in the highlights. Same workflow for OPML imports and podcast feeds where the channel-level metadata moved between elements.

OOXML document.xml diffs

A .docx is just a zip with XML inside. Unzip both versions of a contract, run a diff on word/document.xml, and you see the actual text edits without Word's tracked-changes markup getting in the way. Useful when a paralegal sends back a "clean" copy that supposedly matches a redline; the XML tells you which paragraph elements moved and which run-level formatting changed.

XML quick reference

XML rules that explain most noisy diffs, taken from the W3C specifications.

TopicWhat this tool does
Attribute order Not significant per the XML 1.0 spec. <a x="1" y="2"/> equals <a y="2" x="1"/> to a parser. A text diff will flag the swap. Format keeps the written order; canonicalise both sides (xmllint --c14n) to remove it.
Namespaces URI-bound, prefix-aliased. Two documents binding the same URI to different prefixes are equivalent. See Namespaces in XML 1.0.
CDATA sections Literal text wrapped in <![CDATA[ ... ]]>. The parser does not interpret tags or entities inside. The sequence ]]> cannot appear inside a CDATA block.
Mixed content Elements may contain text, child elements, and whitespace in any order. <p>Hello <b>world</b>!</p> is mixed content and whitespace there is significant.
Comments <!-- comment -->. Cannot contain -- internally. Stripped by most processors. Format and the diff keep them; Minify removes them.
Encoding and BOM Declared via <?xml version="1.0" encoding="UTF-8"?>. UTF-8 BOM is a hidden first character. Upload strips it; pasted text that still has one shows a one-character change at the start of line 1.
XML 1.0 vs 1.1 Almost everyone uses XML 1.0. Version 1.1 adds support for additional Unicode control characters in element content; rarely seen in the wild.
Entity references Five built-ins: &amp; &lt; &gt; &apos; &quot;. Numeric character references like &#233; for accented letters are also valid. Self-closing <br/> and explicit <br></br> are equivalent.

XML diff: frequently asked questions

Will XML attribute reordering or whitespace show up as a diff?

Yes, both will. A text diff compares characters line by line, so reformatting, attribute reordering, or whitespace inside elements all show up as differences even when the document is logically identical. Click Format on both panes first to even out indentation; attributes stay in the order they were written, so a reorder still shows. For element trees with deeply nested children, a structural compare via XSLT or Canonical XML is the next step up. For reviewing a pom.xml, a manifest or a Spring context, Format plus a text diff is usually enough.

Does the order of attributes on an element matter?

No, not to an XML parser. The XML 1.0 spec says attribute order is not significant, so <img src="a.png" alt="x"/> and <img alt="x" src="a.png"/> represent the same element. A character diff will still flag the reorder because it sees the raw text. Format here keeps attributes in their written order, so it will not hide the swap. Run both files through Canonical XML first (xmllint --c14n sorts attributes) and compare the output.

How do XML namespaces affect the diff?

Namespaces are URI-based, but you bind them to short prefixes in the document. Two files that bind http://maven.apache.org/POM/4.0.0 to different prefixes are equivalent under the Namespaces in XML spec, but the text diff will mark every prefix swap as a change. The practical workaround is to format both files and use matching prefixes on both sides. For automated pipelines, a Canonical XML pass normalises this away.

Can I diff XML files with CDATA sections?

Yes. CDATA sections are just text content with the XML parser told not to interpret it, so <![CDATA[<b>raw</b>]]> compares as the literal characters inside. Long CDATA blocks (script tags, embedded HTML, SQL) diff cleanly. The one gotcha is that you cannot have ]]> inside a CDATA section; if your data contains that sequence, the source must split it across two CDATA blocks, which the diff will show as written.

Should I use XSLT instead of a diff?

Use XSLT when you want to transform XML or normalise it before comparing (sort children, drop comments, canonicalise namespaces). Use this diff when you want to see what changed between two specific files. The two are complementary: an XSLT pre-pass plus this diff is a strong workflow for noisy machine-generated XML. For most code-review use cases (pom.xml, AndroidManifest, application context), the diff alone is enough.

Does the encoding declaration or BOM affect comparison?

A bit. The <?xml version="1.0" encoding="UTF-8"?> line is itself part of the document text, so swapping UTF-8 for UTF-16 shows as a one-line diff. A UTF-8 byte order mark (BOM) at the very start is a single hidden character. Upload drops it, because the browser's file reader strips a leading BOM, but text pasted from some editors still carries one. If two pasted files look identical and the diff flags the very start of line 1, suspect the BOM.

Why do my SOAP envelopes diff weirdly when I rename a namespace prefix?

Because text diff is namespace-blind. Renaming xmlns:soap to xmlns:s and updating every <soap:Body> to <s:Body> is a no-op to an XML parser; the bound URI is unchanged and the document is logically identical. The character diff sees every tag as different and lights up the page. The fix is to canonicalise both sides before diffing. XML Canonicalization (C14N, RFC 3076) is the spec used by XML signatures specifically to handle this. Tools like xmllint --c14n or xmlstarlet c14n produce a canonical form that survives prefix renames.

Is it free, and do I need to sign up?

It is free, and you do not need an account. Format, Minify, validation, Upload and the diff itself all work without signing in, and there is no cap on how many XML files you compare. Ads on the page cover the hosting. Signing in only adds a dashboard of your share links, so you can delete one before it expires.

How is this different from other online XML diff tools?

A few things. The parse, format, and diff all run in your browser, so your XML only leaves the tab if you click Share. Plenty of online tools POST it to a server first. The highlighting lands on tag names, attributes, and text rather than whole lines. Validation uses the native DOMParser your browser ships, and Format only adds line breaks and indentation between tags, so a well-formed pom.xml stays well-formed after formatting.

Can it compare two XML files by uploading them?

Yes. Click Upload on either pane to load a .xml, .pom, .config, or .svg file straight into that side, then do the same on the other. The file is read locally and never sent anywhere. You can also paste from the clipboard if you only have the text, which is handy for a SOAP body or RSS snippet pulled from a log.

Can I compare more than two XML files at once?

Not in one view. It is built for two sides, original and changed, which keeps the diff readable. If you have three or more revisions of a config or a feed, compare them in pairs: v1 against v2, then v2 against v3. For a folder of XML files you would script xmllint or a build-time diff instead; this tool is for the focused two-file review.

Is it safe to paste sensitive XML like config files?

Yes, unless you share it. While you compare, your XML stays on your machine: no upload, no logging of what you paste, and no analytics on the content, so a web.config with a connection string or a SOAP envelope with a token stays in the tab. Share is the exception, because it stores both panes on our servers for the link. That said, treat any real secret with care; the safest habit is to redact passwords and keys before pasting, here or anywhere.

Privacy and how this works

Your XML is parsed, formatted, and diffed on your machine and stays there unless you choose Share. Nothing you paste is logged or measured. Parsing and validation use the browser's native DOMParser, and the spec we follow is W3C XML 1.0. Background reading on the format itself is on Wikipedia.