XML Compare Online - Diff Two XML Files Side-by-Side
Updated
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
- ✅ Line-by-line text comparison
- ✅ Side-by-side raw text view
- ✅ Client-side only
How to Use
- Paste the original XML in the left panel
- Paste the modified XML in the right panel
- The tool automatically highlights differences
- Green indicates added content
- Red indicates removed content
- Yellow indicates changed values or attributes
- 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 & 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?
This tool actually compares the two documents as raw text, line by line, with no XML parsing or namespace resolution at all — so ns1:Item and soap:Item are compared as literally different text and will be flagged as a difference even when both prefixes are bound to the same namespace URI — 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
XML Compare is a line-by-line text diff: it lines the two documents up and marks each line as added, removed or changed. That makes it fast and predictable, but it also means it compares text, not meaning. Two documents that differ only in formatting (indentation, attribute order, <empty/> versus <empty></empty>, or a different namespace prefix bound to the same URI) will show differences even though an XML parser would treat them as equivalent. The practical fix is to normalize both sides before comparing. Running each document through the XML Formatter with the same indent size removes indentation noise, which is by far the most common source of false differences. Differences that remain after formatting are real changes to elements, attribute values or text. For configuration files and SOAP payloads this is usually what you want: a readable list of what changed between two versions. If you need a comparison that ignores attribute order or resolves namespaces, use a schema-aware XML tool or a library such as xmldiff, since those rules depend on your schema.