Skip to content

Diff Checker: Compare Two Texts

Compare two texts line by line and see what was added, removed or changed, word by word, side by side. Runs in your browser: nothing is uploaded.

Runs in your browser

Everything happens on your device: nothing you paste or type is sent to our server or stored. A share link holds your settings, and your input only if you choose to include it.

Lines that differ only in indentation or trailing spaces count as the same.

Off: a line ending in CRLF differs from the same line ending in LF, as GNU diff reports it.

More options

For the unified diff download and the collapsed view; 3 is the GNU diff default.

6 lines · 80 bytes · limit 2 MB

7 lines · 95 bytes · limit 2 MB

Differences

Original text on the left, changed text on the right
1Shopping list1Shopping list
2Removed: - 2 litres of milk2Added: - 2 litres of oat milk
3- bread3- bread
4Removed: - 6 eggs4Added: - 12 eggs
5- coffee beans5- coffee beans
6Added: - bananas
6Pick up at 5 pm7Pick up at 5 pm

2 lines removed, 3 lines added.

Removed
2
Added
3
Unchanged
4
Hunks
1

Method: Myers line diff (1986), word highlights; unified format as GNU diff -u · jsdiff (diff) 9.0.0

Off by default. When on, your input is packed into the part of the link after “#”, which browsers never send to any server; anyone you give the link to will see it.

How it works

The tool splits both texts into lines and finds the shortest list of line removals and additions that turns the original into the changed version, using Eugene Myers' 1986 O(ND) algorithm, the same method GNU diff and Git use by default. Lines that survive unchanged form the longest common subsequence of the two texts; everything else is a removal, an addition, or both.

When a removed line sits right before an added one, the two are paired as a changed line and compared again word by word, so only the words that differ are highlighted. The unified diff you can copy or download follows the GNU diff -u format: a header for each file, then hunks that start with @@ and show the changed lines with 3 unchanged lines of context (you can change that number), exactly as patch and Git expect.

The comparison runs in your browser with the open-source jsdiff library, loaded only on this page the first time you change something. Texts over 200 kB are compared in a background thread so the page stays responsive. Neither text is uploaded.

Standards this tool follows

Diff Checker: How to Compare Two Texts and Read a Diff

By FindMySum · Last reviewed

A diff checker shows exactly what changed between two versions of a text: which lines were removed, which were added, and which words changed inside a line. Paste the original on the left and the new version on the right; the differences appear straight away, and both texts stay in your browser.

What people use it for

Comparing two drafts of a contract or an essay to find the sentence someone quietly edited. Checking a configuration file against a known-good copy before a deployment. Seeing what a colleague changed in a SQL query or a block of code they pasted into a chat. Confirming that two long lists, such as exported email addresses, really are the same. Anywhere two versions of text exist, a diff is faster and more reliable than reading both side by side.

How to use the tool

  1. Paste the older version into Original text and the newer one into Changed text. Swap them if you got them the wrong way round; removals and additions trade places.
  2. Choose Side by side to read the two versions in parallel, or Inline for a single column, which is easier on a phone.
  3. Turn on the ignore options when spacing, letter case or line endings aren't what you care about.
  4. Long stretches of unchanged lines are folded away; select one to expand it.
  5. Copy or download the unified diff to attach to a bug report or apply with a patch tool.

A worked example

Take a shopping list where "milk" became "oat milk", "6 eggs" became "12 eggs", and "bananas" was added. The line diff finds 4 unchanged lines, 2 changed lines and 1 added line. In the changed lines, the word highlight marks only "oat " and "12": the rest of each line is the same. The unified diff starts with @@ -1,6 +1,7 @@, because the hunk covers all 6 lines of the original and all 7 of the changed list.

Reading the result

Red lines with a minus sign exist only in the original; green lines with a plus sign exist only in the changed text. A changed line shows both, with the differing words marked more strongly, so the change doesn't depend on colour alone. The counts under the diff add up the lines removed and added: a changed line counts once as removed and once as added, as GNU diff counts it.

Common mistakes

Comparing in the wrong direction. If additions look like removals, the texts are the wrong way round; use the swap button.

Chasing invisible differences. Copying from a PDF, a word processor or a web page can add non-breaking spaces, curly quotes or trailing spaces. When a line looks identical but shows as changed, try the ignore options first.

Expecting it to understand meaning. A diff compares characters and lines, not ideas. Reordering two paragraphs shows as one removed and one added, even though nothing was rewritten.

To count the words or characters in either version, use the word counter.

Sources

Frequently Asked Questions

Why does a line show as changed when it looks identical?

Something you can't see differs: a trailing space, a tab instead of spaces, a non-breaking space, or a Windows line ending (CRLF) against a Unix one (LF). Turn on the options to ignore spaces at the start and end of lines, or to treat CRLF and LF as the same, and the line will match. If only one text ends with a line break, its last line is reported as changed too.

What do the @@ lines in a unified diff mean?

Each @@ line starts a hunk. '@@ -12,7 +12,8 @@' means the hunk covers 7 lines of the original starting at line 12 and 8 lines of the changed text starting at line 12. Lines that begin with a minus were removed, lines with a plus were added, and lines starting with a space are unchanged context.

Can I apply the downloaded diff with patch or Git?

Yes. The download is a standard unified diff with the file names 'original' and 'changed'. Run 'patch yourfile < changes.diff', or 'git apply' after renaming the two header lines to your file's path. Diffs made with the ignore options turned on may not apply cleanly, because they leave out differences the patch tool still sees.

Is there a size limit?

Each text can be up to 2 MB, roughly 40,000 lines of code. Very different texts take longer, because the work grows with the number of changes, so the tool stops and says so when two large texts have more than 50,000 changed lines.

Spotted a wrong result or a bug? Report a problem (the link sends the page address only, never what you entered).

May we count your visits with Invoker Analytics? It keeps a random visitor number in your browser. Your calculator inputs are never sent. Privacy policy