Compare XML VSCode Extension

Run semantic XML comparisons in VSCode with aligned diffs and difference navigation.

Compare XML is also available as a VSCode extension powered by the same comparison engine as the website. It brings semantic XML comparison into your editor, with control over how elements, attributes, values, and repeated child elements are matched.

Installation

Search for Compare XML (publisher: unitstack) in the VSCode Extensions view, or install it from the VSCode Marketplace.

Compare Two XML Documents

  1. Open an XML file.
  2. Run Compare XML: Compare Active Editor with… from the command palette (Ctrl+Shift+P / Cmd+Shift+P) or the editor title menu, then choose another open editor, a file on disk, or the clipboard.
  3. The result opens in VSCode’s native diff editor. Both sides are padded so corresponding elements line up, even when whole blocks were added or removed.

You can also right-click a .xml file in the Explorer and choose Select for Compare, then Compare with Selected on the second file, following VSCode’s built-in file comparison flow.

Difference Navigator

The Compare XML sidebar groups differences by kind: Added, Deleted, and Value Changed. Click an entry to jump to that difference in the diff editor.

The sidebar title bar also provides actions to:

  • Configure Comparison Options — open the options picker.
  • Swap Sides — exchange Base and Contrast.
  • Clear Results — end the current comparison session.

Comparison Options

Configure options per comparison with Compare XML: Configure Comparison Options, or set workspace defaults in settings.json:

SettingDefaultDescription
compare-xml.arrayCompareMethodbyIndexMatch repeated child elements by byIndex, lcs, or unordered multiset comparison.
compare-xml.keyCaseInsensitivefalseIgnore case when matching element and attribute names.
compare-xml.valueCaseInsensitivefalseIgnore case when comparing text and attribute values.

Unordered comparison ignores order but still counts duplicate occurrences. See XML Comparison Rules for matching examples, parser normalization, and namespace-prefix behavior.