Paste or upload two HTML documents and compare them side-by-side, down to the single attribute value or word that changed.
What is the HTML diff tool?
The HTML diff tool compares two HTML documents as source text and highlights each changed tag, attribute value and word. Drop last month's landing page into the left pane and this week's build into the right. Nothing is uploaded unless you press Share.
The diff itself is character-level, and the panes show your markup exactly as written: no reformatting and no syntax colouring, so every highlight is a real difference in the source. If the two files are indented differently, run both through Prettier or HTML Tidy first, or turn on Ignore spaces in the options menu. What counts as equivalent markup is defined by the WHATWG HTML Living Standard, and the quick reference below covers the cases that trip up a text diff.
If you have ever shipped a copy edit to a marketing page and lost an hour figuring out why a class name on the hero section also changed, a diff of the two builds would have shown the class change on the same line as the copy edit. For plain prose, you can compare text online on our main page. HTML's strict cousin, XML, has a dedicated XML diff. And because Markdown often compiles to HTML in static-site builds, the Markdown diff is a useful neighbour.
A text diff, not a DOM diff
This compares source text, not the DOM. Lines are paired first, then each edited line is compared character by character, and a cleanup pass keeps the highlight on a tag name, an attribute value or a run of visible text rather than a lone quote mark. Added markup is green on the right, removed markup red on the left.
HTML has more parsing quirks than people remember, and most of them only matter when you compare two files as text. Per the parsing algorithm, attribute order is not significant, attribute quoting can be single, double, or absent for some values, and tag and attribute names are case-insensitive. A text diff still flags every reorder and case swap. The practical workaround is to format both sides with the same tool (Prettier with parser: "html" works well) so the panes are normalised before you read the diff.
This tool does not parse the document into a DOM tree and compare nodes. That means two files that render identically in a browser, for example one with <img src="a.png"> and one with <img src='a.png' />, will still appear different here. If you need a true structural compare, parse both sides with DOMParser and walk the trees yourself, or run both through Tidy first. For everyday review work (a copy edit, an attribute swap, an aria-label addition), the text diff is faster and clearer.
How to compare HTML in three steps
No signup, and nothing goes to a server unless you share. Most comparisons take less than a minute.
- 1
Paste or upload your HTML
Paste the old HTML on the left and the new HTML on the right. To work from files instead, Upload takes an .html, .htm, or .eml file directly. Sample loads a short landing-page snippet into both panes.
- 2
Even out formatting if the files differ
If one file is minified or indented differently, run both through the same formatter first (Prettier with parser: "html" works well) and paste the results. For indentation-only differences, the Ignore spaces option in the settings menu treats runs of spaces and tabs as one, so the diff sticks to real content changes. To check that each file is valid HTML, use the W3C validator.
- 3
Read the diff
Red shading on the left marks removed markup, green on the right marks added markup. The count in each header totals the edits across tag names, attribute values and visible text, and the up and down arrows step through them one at a time.
Typical HTML diff jobs
Comparing two server-rendered template outputs
A CMS template change goes out and a downstream consumer reports broken hero markup. Curl the rendered HTML before and after the deploy, paste both into the diff, and the offending wrapper <div> or class swap is obvious. Useful for WordPress theme upgrades, Hugo and Jekyll layout edits, and any server-rendered output where the source template is not directly readable.
Diffing email-template HTML before an A/B test
Email HTML is unforgiving. Outlook still uses the Word rendering engine, so a swapped <table> nesting or a renamed inline style attribute can shatter the layout. Diff variant A against variant B before you push the campaign, then run both through Litmus or Email on Acid. Catching a missing cellpadding="0" in the diff is cheaper than catching it in a thousand inboxes.
Reviewing accessibility-attribute changes in a PR
A PR adds aria-label, role, and aria-describedby attributes across half the components. The text diff makes it trivial to confirm every interactive element gained the right attribute, no role="presentation" was applied to a real button, and no focusable element lost its accessible name. Pair this with axe DevTools or Lighthouse for the actual audit.
Comparing a marketing landing page after a copy edit
A copywriter sends back the homepage with revised headlines and a new CTA. Paste the live HTML against the proposed HTML and the diff tells you exactly which <h1>, <p>, and button text changed, plus any class or href edits that came along for the ride. Faster than a tracked-changes Word doc and it survives the round-trip into the codebase intact.
Auditing an HTML sanitizer's output for XSS regressions
After a DOMPurify or sanitize-html version bump, regression-test the sanitizer with known-bad payloads and diff the output against a previous good baseline. A sanitizer that suddenly preserves <svg onload="..."> or javascript: URLs in href attributes is exactly the kind of regression you want to catch in CI before it ships. The diff makes single-character changes (a missing escape) jump out.
HTML quick reference
Parsing rules from the WHATWG HTML Living Standard that make two equivalent files diff as different.
| Topic | What this tool does |
| Void elements | <img>, <br>, <input>, <meta>, <link>, <hr> and friends have no closing tag. The XHTML-style trailing slash <br /> is allowed in HTML5 but renders as a no-op; the parser ignores it. |
| Attribute order | Not significant per the HTML spec. <a href="/x" class="btn"> and <a class="btn" href="/x"> are identical to a parser. A text diff flags the swap, and only a formatter that sorts attributes makes it go away. |
| Attribute quoting | Double quotes, single quotes, or no quotes at all for values without spaces or special characters. id=hero, id='hero', and id="hero" are equivalent. Most style guides require double quotes for consistency. |
| Boolean attributes | Presence is what matters. <input disabled>, <input disabled="">, and <input disabled="disabled"> all disable the input. The spec recommends the bare form; XHTML required the verbose form. |
| Case sensitivity | Tag names and attribute names are case-insensitive in HTML (<DIV> equals <div>). Attribute values are case-sensitive (id="Hero" differs from id="hero"). The convention since HTML5 is lowercase tags and attributes. |
| Character entities | Five built-ins: & < > " '. Plus named entities like and numeric references like é for accented letters. CDATA sections are only valid in foreign content (SVG, MathML), not regular HTML. |
| DOCTYPE | HTML5 uses the short form <!DOCTYPE html>. Older XHTML 1.0 doctypes are still parsed but trigger no-quirks mode the same way. A missing or malformed DOCTYPE drops the page into quirks mode, which changes box-model behaviour. |
| Whitespace | Runs of spaces, tabs, and newlines collapse to a single space when rendered, except inside <pre>, <textarea>, and elements with white-space: pre CSS. The source text is preserved, so a text diff sees every byte. |
HTML diff: frequently asked questions
Why use the HTML diff view instead of plain text for markup?
The engine is the same character-level diff as our text compare tool, and the panes show raw source in both cases. This page is set up for markup: Upload accepts .html, .htm and .eml files, the sample is a typical landing-page edit, and the reference below covers attribute order, entities and whitespace. Highlights land on the changed attribute value or word inside a line, which is what keeps a dense line of markup readable.
Does the order of attributes on an element matter?
Not to a browser. The HTML Living Standard says attribute order on a start tag is not significant, so <a href="/x" class="btn"> and <a class="btn" href="/x"> render identically. A text diff will still flag the swap because it sees the raw characters. Prettier keeps attributes in the order they were written, so it will not hide the swap. If attribute order is pure noise in your review, sort attributes in the source with a formatter plugin before comparing, or read the swap and move on.
Why does whitespace between elements show up in the diff?
HTML collapses most runs of whitespace into a single space when rendering, so two files that look identical in a browser can have wildly different source text. Inside <pre> and <textarea>, whitespace is preserved. The diff is text-level, so every space, tab, and newline counts. Turn on Ignore spaces in the options menu to treat runs of spaces and tabs as one, or run both files through the same formatter before pasting, and only the meaningful changes stay highlighted.
Can I compare DOM structure while ignoring formatting?
This tool does a text diff, not a DOM diff, so the most reliable way to ignore formatting noise is to format both sides with the same pretty-printer (Prettier or HTML Tidy) before pasting. That normalises indentation, attribute quoting, and trailing whitespace. For a true tree-level compare, parse each side with DOMParser and walk the nodes; for code review and copy-edit work, the format-then-diff workflow is faster and catches the same bugs.
How are inline JavaScript and CSS handled?
The contents of <script> and <style> are diffed as plain text, character by character. That means a one-line CSS change inside a <style> block or a renamed function inside an inline <script> will show up exactly where you expect. For larger script blocks consider extracting to .js files and diffing those separately. Because highlights stay inside the line that changed, the surrounding markup stays readable.
What about character encoding and entities?
Files are read as UTF-8, which is the default for HTML5 and what the <meta charset="UTF-8"> tag declares. Named entities like &, <, >, and diff as their literal source text, not their decoded form, so a swap from to a real space character will show as a change. Upload drops a UTF-8 byte order mark, but pasted text can still carry one: if two pasted files render identically and the diff lights up at the very start, suspect a BOM.
Is it free, and do I need to sign up?
Completely free, no account required. Open the page, paste your HTML, and the diff runs immediately in your browser. There is no file size tier, no rate limit, and no email wall. The only real constraint is browser memory: very large files (think multi-megabyte Jinja or Handlebars template bundles) may slow the editor on older machines.
How is this different from other online HTML diff tools?
Many online diff tools send your HTML to a server before comparing it. Here the compare runs in your browser, and only the Share button stores anything. The highlighting is character-level inside paired lines, so a changed class name or data-* value lights up on its own instead of the whole line, which matters in markup where one line can carry a dozen attributes.
Can it compare two HTML files I upload?
Yes. Each pane has an Upload button that accepts .html, .htm, and .eml files. The file is read locally by the browser, so loading it sends no bytes anywhere. Once loaded, you can still edit the pane directly before running the diff, which is handy if you need to strip a <head> section or normalise inline styles before comparing.
Can I compare more than two HTML files at once?
The tool is a two-pane diff: one original, one changed. Comparing three or more files at once is not supported. The practical workaround is to diff A against B, note the changes, then diff B against C. For large batches of template variants (Handlebars partials, for instance) a command-line tool like diff or a Git diff is faster.
Is it safe to paste HTML with private data or internal URLs?
Yes. The diff runs entirely in your browser. Comparing sends none of your input to a server, and nothing is logged or stored. You can safely paste HTML containing internal href values, data- attributes with session tokens, or any other content that should not leave your network. The one exception is Share: it stores both panes on our servers so the link can open, so skip it for anything sensitive.
Privacy and how this works
Your HTML stays in your browser unless you click Share. The diff runs on your machine, locally. We do not log or measure what you paste. The markup rules on this page follow the WHATWG HTML Living Standard; the retired W3C HTML 5.2 recommendation still helps as a cross-check. Element-level reference docs are on MDN, and accessibility patterns come from the ARIA Authoring Practices Guide. Background reading on the format itself is on Wikipedia.