This page's code did not start.

Opening index.html directly from a folder blocks JavaScript modules, so nothing will happen when you choose a file. Serve the folder over http instead:

powershell -ExecutionPolicy Bypass -File serve.ps1

Then open http://localhost:8080/.

Text Diff — compare two texts, side by side

Two texts in, every difference marked, line by line and word by word. Nothing is pasted into anyone else's server.

Language: English
View source
Your texts are processed in your browser. No processing upload.

A comparison is arithmetic over two strings, done here, in this page. The algorithm is Myers' — the one git diff uses — and it is hand-written in src/diff.js, where you can read it. This tool has no network feature of any kind — nothing to fetch, nothing to send — which matters here because the things people compare are contracts, config files and unreleased code, in pairs.

Live check: checking…

Offline: checking…

Don't take our word for it: open DevTools, watch the Network tab, and compare something. Not one request carries a character of what you pasted. Or unplug from the internet and compare it anyway.

1 Paste the two texts

empty
empty

2 Choose how to read it

Ignore blank lines These options only change the view. Copy and Download include every difference.

3 Read what changed

Nothing yet.

View as Markdown

How to compare two texts without uploading them

  1. Paste the two texts, or drop the two files. The original on the left, the changed one on the right. Two files dropped on the picker at once land one either side, in the order you dropped them; swap sides if that was the wrong way round.
  2. Choose how to read it. Side by side, or one column. A phone starts on one column, because side by side needs two columns of text and a phone has room for about one; the menu is right there either way.
  3. Ignore what does not matter. Whitespace, upper and lower case, blank lines — each can be ignored so that a reformatted file does not read as a hundred changes. By default the unchanged middle is folded to a count, with three lines kept either side of every change.
  4. Read what changed. Removed lines are marked on the left, added ones on the right, and inside a changed line the words that differ are highlighted — so a diff of two paragraphs shows the word that moved rather than two whole paragraphs.
  5. Take the patch. The download is a .patch in the unified format, which is what a code review, git apply and every diff viewer expect. Copy puts the same thing on your clipboard.

The longer version

How to compare two JSON files Format both files the same way, sort the keys, then diff them. Why a raw JSON diff is mostly noise, how to canonicalise both sides in the browser, and what survives to the patch.

Questions

Are my texts uploaded anywhere?

No. The comparison is a function that runs in your own browser, on your own hardware. This tool has no network feature of any kind — it never fetches anything and never sends anything — and the page's Content-Security-Policy names every address it may contact, none of which belongs to this site. That is the reason to use it for a contract, a config file or unreleased code: pasting those into somebody else's diff checker is giving them away, both versions at once.

What does the comparison actually do?

It finds the shortest set of edits that turns the left-hand text into the right-hand one, using Myers' algorithm — the one git diff uses. Shortest is what makes a diff readable: a line inserted in the middle should show as one insertion rather than as every line after it having changed. Inside a changed line the words that differ are marked as well, so a diff of two paragraphs shows the word that moved rather than two whole paragraphs.

Can it compare two files rather than two pastes?

Yes. Drop both onto the picker at once and they land one either side, in the order you dropped them. They are read by your browser into this page, which is the only place they go. Swap sides if you dropped them the wrong way round.

What comes out of a comparison, and can I apply it?

The download is a unified diff — the @@ -3,5 +3,5 @@ format that git apply, patch and every code review tool read. Copy does the same thing to your clipboard. What is on screen is a view of it: side by side, or one column, with the unchanged parts collapsed to a count unless you ask for all of them.

Can it ignore whitespace, case or blank lines?

Yes, each separately. Ignoring whitespace makes a reformatted file compare as unchanged; ignoring case treats Error and error as the same word; ignoring blank lines skips the lines that hold nothing. The counts above the result then say the two are the same once the differences you asked to ignore are ignored — which is not the same claim as identical, and the page keeps the two claims apart.

How big a comparison can it handle?

There is no limit set here, because there is no server paying for one. Two texts of twenty thousand lines with a handful of edits compare instantly, because the common beginning and end are trimmed before the real work starts. A comparison of two texts with nothing whatever in common stops early and says so, rather than spending a minute proving what was already obvious, and a very long comparison draws the first few thousand rows and leaves the rest to the downloaded patch.

Is it free, and do I need an account?

It is free, and there is no account, no sign-in, no trial and no limit on how much you paste. The site carries advertising, which is what pays for it; the ads are not given anything about your texts.

Does it work offline?

Yes. Load the page once, then disconnect from the internet and it keeps working. That is also the simplest way to prove nothing is being uploaded: a tool that sent your texts away to be compared would stop the moment you unplugged.