Loading editor…

Tree /

Output initialises when this pane is visible.

Initialising…
0 B idle

What is XML diff?

Compare two XML documents with inline change highlighting.

XML diff shows what changed between two XML files — new elements, removed attributes, and edited text nodes. Use it when reviewing config updates, comparing API responses, or auditing template changes before deployment.

XML comparison can be noisy when whitespace or attribute order differs. Normalise each side with format, minify, or sort siblings before diffing when you care about semantic changes rather than formatting.

All comparison runs in your browser; no document content is uploaded.

How to use

Step-by-step guide for XML Diff & Compare. Everything runs locally in your browser.

Quick start compare two documents
  1. Put the original XML in the left (A) pane and the modified copy in the right (B) pane.
  2. Changes highlight in the diff gutter as you edit either side.
  3. Use per-side toolbar buttons to normalize before comparing.
Sort, Ignore WS, Format, Minify per-side controls
  • Sort — reorder sibling elements alphabetically on that side only.
  • Ignore WS — treat indentation and line breaks as insignificant in the diff.
  • Format / Minify — pretty-print or compact that side without changing the other.

Workflow tip: if the diff is mostly whitespace, click Format on both sides, then toggle Ignore WS.

When to use each option common scenarios
GoalTry
Same XML, different element orderSort on both sides
Noisy indentation onlyIgnore WS or Format both sides
Readable side-by-side reviewFormat on one or both sides

Need tree view, schema validation, or other modes? Open XML Editor Pro for the full guide with Diff examples and workflows.

Features

What this XML Diff & Compare page offers — processed locally in your browser.

Side-by-side diff

Compare original and modified XML with inline change highlighting.

Per-side normalize

Sort siblings, ignore whitespace, format, or minify each side independently.

Swap & samples

Swap A/B in one click and load sample pairs from the sidebar.

100% private

All processing runs in your browser. Nothing is uploaded.

FAQ

Common questions about XML Diff & Compare.

Is my XML data safe?

Yes. Parsing, formatting, diffing, validation, XPath, transforms, and XSLT all run inside your browser. Data is not sent to a server. The only local storage is your session in localStorage, which you can clear in browser settings.

Does it work offline?

After the first visit (when Monaco and assets are cached), you can edit, format, diff, and transform without a network connection. “Load from URL” still needs network access and a CORS-friendly server.

What can Auto-fix repair in XML?

Auto-fix handles many well-formedness problems: unclosed or mismatched tags, duplicate attributes, unquoted attribute values, bare & in text, broken comments and CDATA sections, and orphan closing tags. It appears in the status bar when parsing fails and inside Validate mode with per-error fix buttons. Auto-fix does not change XSD-valid content — it only makes XML syntactically parseable so you can continue editing or run schema validation.

Can I compare two XML files with elements in a different order?

Yes. Open Diff mode (Ctrl/⌘+D), paste the second file on side B, and keep Sort enabled on both sides. Sibling elements are reordered using a stable canonical ordering so equivalent documents align. Turn Sort off when sequence matters (e.g. ordered event lists).

Quick try: load the sample catalog, open Diff, paste the same XML on B but swap the two <book> blocks. With Sort on, the diff should be empty; with Sort off, you will see the blocks highlighted as changed lines.

Walkthrough: comparing two config exports step by step
  1. Paste your production config in the left editor.
  2. Press Ctrl/⌘+D to enter Diff — that becomes side A.
  3. Copy the staging export and click Paste on the B toolbar — that becomes side B.
  4. Confirm Sort and Ignore WS are active on both toolbars (blue).
  5. Scan for red/green lines. No highlights? The exports are equivalent for compare purposes.
  6. Still noisy from indentation? Click Format on A and B.
  7. See a difference in a list of items? Turn Sort OFF — if it disappears when you turn Sort back on, only order differed; if it stays, content or structure really changed.
Why do Sort or Ignore WS change what I see in the diff?

Those options rebuild the view from your source text: Sort reorders elements; Ignore WS normalises whitespace in text nodes and tells the diff engine to ignore leading/trailing spaces on each line. Your stored source is kept separately so toggling options updates the display without losing the original unless you edit the diff pane itself.

Do comments survive diff normalization?

When Sort or Ignore WS is on, the file is parsed with DOMParser and comments are not preserved in the diff view. For comment-sensitive compares, turn both off on that side — Format/Minify still work on the raw text.

Which XPath version is supported?

XPath 1.0 (browser document.evaluate). Unprefixed names match local element names; the sample catalog avoids a default namespace so paths like /catalog/book/title work as expected.

What transform outputs are available?

JSON, YAML, CSV, Markdown, and HTML table. Pick a target in Transform mode and click Convert. Conversion uses the browser DOM — very large documents may take a moment.

Other tools

Load XML from URL

The URL must allow CORS. Plain XML only.

Paste XML

Clipboard access denied. Paste your XML below.