Compare Text (Diff Checker)

Paste the original on the left and the changed version on the right. Additions show in green and deletions in red, word by word or line by line.

Differences (2 added, 1 removed)

The quick brownred fox jumps over the lazy dog. The very end.

Green is new in the changed text; red with a line through is gone from it.

Last reviewed:

How a diff checker finds what changed

A diff doesn't hunt for changes directly. It looks for the longest run of words (or lines) that both versions share in the same order, known as the longest common subsequence. Anything in the original that isn't part of that shared run was deleted, and anything in the new version that isn't part of it was added.

Example: One sentence, two edits

  1. Original: The quick brown fox jumps over the lazy dog.
  2. Changed: The quick red fox jumped over the lazy dog.
  3. Shared, in order: The quick, fox, over the lazy dog.
  4. Not shared: brown and jumps (removed), red and jumped (added)

Two words swapped, and everything else confirmed unchanged.

The approach goes back to the Unix diff program. Hunt and McIlroy's 1976 Bell Labs report describes diff as solving the longest common subsequence problem to find the lines that don't change between two files. Before comparing, this tool also sets aside any identical opening and closing sections, since most edits touch only a small part of a document.

What one change looks like by words and by lines

ChangeCompared by wordsCompared by lines
One word edited in a long lineJust that wordThe whole line, removed and added
A comma added after a wordThat word, because punctuation sticks to itThe whole line
“10am” changed to “10 am”10am removed, 10 am addedThe whole line
A paragraph moved elsewhereRemoved in one place, added in the otherThe same

Because punctuation counts as part of the word it touches, “delivery.” and “delivery,” are different words. That's useful for proofreading, since every changed comma shows, but a heavily repunctuated paragraph lights up more than its wording changes suggest.

Comparing code, data and lists line by line

For code, settings files, CSV exports and lists, compare by lines. Each line usually stands for one thing, whether a statement, a setting or a record, so a changed line is the natural unit to report. It also keeps the result readable: one changed value shows as one line out and one line in, not a scatter of fragments.

Example: Two versions of a shopping list

  1. Original lines: milk, eggs, bread, butter
  2. Changed lines: milk, bread, butter, jam
  3. Result: eggs removed, jam added, the other three unchanged

Lines mode finds the two real changes even though everything after eggs moved up a line.

If the order of a list doesn't matter at all, only which items are on it, Compare Two Lists is the better fit. It ignores order and repeats, and sorts every item into only in the first list, only in the second, or in both.

Checking a contract or policy for quiet changes

Example: A revised payment clause

  1. Original: Payment is due within 30 days of delivery.
  2. Revised: Payment is due within 15 days of the invoice date.
  3. Removed: 30 and delivery.
  4. Added: 15 and the invoice date.

Two small edits halve the time to pay and move the day the clock starts. Both are easy to miss when you only read the new version.

In a contract, lease or policy, give the most attention to numbers, dates, names, small negations such as not, no and never, and the difference between may and must. Those are the edits that change what a document means while barely changing how it looks.

The same check works for essays and reports. Compare your draft with the copy a tutor or colleague edited and every suggestion shows at once, including the easy-to-miss ones like a deleted “not” or a changed number.

Paste plain text on both sides. Text copied from two PDFs breaks lines in different places, which makes nearly every line look changed, so run both through Clean PDF Text first.

Why a small edit can look like a big one

  • Reflowed paragraphs. If one version has a line break every 70 or so characters and the other has none, lines mode marks everything. Switch to words.
  • Moved text. A diff only knows removed and added, so a paragraph moved from the start to the end appears twice, once in each color.
  • Curly and straight quotes. One program may turn "quotes" into “quotes”, changing every quoted word. Make them match with Find and Replace before comparing.
  • Spacing. In words mode, an extra space or an extra blank line is a change of its own and shows up between the words.
  • Very long, very different texts. Past a certain size, the changed middle section is shown as one block removed and one block added so the page stays responsive. Compare a section at a time for detail.

Sources and further reading

How to use it

  1. 1Paste the original text and the changed text.
  2. 2Choose to compare by words or by lines.
  3. 3Read the highlighted differences.

Questions

Words or lines: which should I use?

Words for edited prose such as essays, contracts and articles. Lines for code, lists and data, where each line stands on its own.

Is there a size limit?

No hard limit, but very long, very different texts are compared in a simpler way so the page stays fast. For whole books, compare a chapter at a time.

Is my text uploaded anywhere?

No. Everything happens in your browser; your text never leaves your device.

Also handy: Text to QR Code, Shuffle a List