Structural HTML Diff in Your Browser

Compare Two HTML Documents with Structural Context

A semantic HTML diff tool that understands DOM structure — not just text. Review element, attribute, text, comment, and doctype changes with path context.

Base HTML

Contrast HTML

HTML Documentation

Find task-based guides for comparing HTML, loading and sharing results, offline review, and automation.

Start with HTML comparison

Learn the basic workflow and the fixed rules behind HTML Data Compare.

Load & share comparisons

Build result URLs and create share links, with encoding and privacy details.

Offline & original-text review

Install the shared PWA for offline access or inspect original markup in Git Diff.

Automate HTML comparison

Run comparisons through agent skills or the Model Context Protocol.

Semantic HTML diff vs. text diff

Data Compare examines the parsed tree; Git Diff remains available when the original source text matters.

Ignore source-only layout changes

Attribute order and line breaks around a tag do not change the parsed element. These buttons compare as equal in Data Compare.

<button class="primary" type="submit">Pay</button>
<button
  type="submit"
  class="primary"
>Pay</button>

Keep meaningful content changes

Comments and text are compared, and numeric-looking strings stay text. Both examples below contain real semantic edits.

<!-- deployed -->
<p>Price: 1.0</p>
<!-- proposed -->
<p>Price: 1</p>

Whitespace-only nodes between elements are ignored, but whitespace within meaningful non-empty text is not generally normalized. Results are reconstructed from parsed nodes rather than mapped back to exact source lines.

Need reorder, doctype, and parser-recovery details? Read the HTML comparison rules

Need to inspect the original HTML text line by line? Read the HTML Git Diff view guide

HTML comparison rules

The tool uses fixed structural rules—there are no child-matching methods or normalization settings to configure.

Compared itemFixed behaviorWhat to remember
Child nodes

Fixed LCS matches node type and element tag while preserving order, then compares matched nodes recursively.

Reorders can appear as nested edits or add/delete pairs; there is no move or unordered mode.

Attributes

Names and values are compared independently from source order, with added, deleted, and changed values reported.

Attribute values remain case-sensitive strings; no ignore-case or numeric conversion option exists.

Text

Whitespace-only nodes are skipped, while meaningful non-empty text values are compared without general whitespace normalization.

A doubled space can matter, and 1 and 1.0 remain different strings.

Comments & doctype

Comment content and parsed doctype name, public ID, and system ID are represented and compared.

Comments are not ignored. parse5 recovers malformed markup; this is not standards validation.

Use Cases

Review real markup changes in rendering, testing, communication, and monitoring workflows.

SSR & Template Revisions

Compare deployed and newly rendered pages after a template refactor. Separate attribute and text edits from added or removed regions before release.

Component Fixtures

Review saved HTML renders from component tests or Storybook-style fixtures. Inspect structural changes while keeping the original text available in Git Diff.

Email HTML

Check revisions to transactional or marketing email markup. Verify links, attributes, nested tables, and content without assuming parse5 recovery proves email-client compatibility.

Scraping & Page Monitoring

Compare two fetched or saved snapshots to investigate changed markup. Account for parser recovery and meaningful text whitespace when reviewing dynamic page output.

FAQ

01Is my HTML data sent to a server?
Entering or pasting HTML for comparison does not upload it. Parsing and comparison run locally in your browser. Using Share uploads the compared content to our share server. Data placed in URL query parameters is sent with page requests and may be recorded in hosting logs, so do not place sensitive data in URLs. Importing from a URL sends a request to the source you specify.
02Does HTML formatting affect the comparison?
Attribute order and whitespace-only text nodes between elements do not create Data Compare differences. Whitespace inside meaningful non-empty text is not generally normalized, so a changed space can still matter. Git Diff compares the original source text.
03Does a successful comparison mean my HTML is valid?
No. validateHTML is not a standards validator, and parse5 can recover from malformed markup by constructing a repaired tree. The result is reconstructed from parsed nodes, so use a dedicated validator for conformance checks.