Diff Checker: Compare Two Texts
Paste the old version on the left and the new one on the right. Added, removed and changed lines are marked right away, down to the words that changed.
This screen is too narrow for two columns, so the result is shown in one.
Paste two texts to see what changed. Shortcut: Ctrl or Cmd + Enter.
Differences
- Lines that differ
- 0
- Added (+)
- 0
- Removed (-)
- 0
- Changed
- 0
- Same
- 0
- only in the original, + only in the changed text. Inside a line, old words are struck through and new ones underlined.
Your texts are compared on this device and are not uploaded to any server.
How to use it
- Paste the old text into Original text and the new version into Changed text, or load a text file (.txt, .csv, source code) with Open file.
- The differences appear below as you type. Lines marked - are only in the original, lines marked + only in the changed text. Inside a changed line the old words are struck through and the new ones underlined.
- Tick the options under Ignore when differences in case, spacing or blank lines don't matter to you.
- Press Copy diff to copy the result as a unified diff, for example to send it to a colleague or keep it with a revision.
How the differences are found
Both texts are split into lines. The tool then looks for the longest common subsequence: the lines that appear in both texts in the same order. Every line outside that sequence is a difference. The search uses Myers' algorithm (1986), the same one Git and GNU diff use, so as few lines as possible are marked.
Then, in each block of changes, every removed line is paired with the most similar added line. Each pair is compared again word by word, and words that differ by a letter or two (say color and colour) are compared letter by letter. Numbers are marked whole, so 100 changing to 120 shows as one number replaced.
Example
Original: Buy rice, Buy sugar, Pay electricity, Pick up Sam, Wash the car (5 lines). Changed: Buy rice, Pay electricity, Pay water, Pick up Sam at 4, Wash the car. The longest common subsequence is 3 lines: Buy rice, Pay electricity, Wash the car. The rest gives this result:
| Line | Mark | Result |
|---|---|---|
| Buy sugar | - | Removed |
| Pay water | + | Added, not similar to any old line |
| Pick up Sam → Pick up Sam at 4 | - and + | Changed, " at 4" underlined |
| The other 3 lines | space | Same |
What the Ignore options do
- Upper/lower case: "London" counts as the same as "LONDON".
- Spacing: a run of spaces or tabs counts as one space, and spaces at the start and end of a line are ignored. "a b" equals "a b", but "ab" still differs from "a b".
- Blank lines: lines that are empty or contain only spaces are left out of the comparison. They are still shown, without a mark.
Limits
Windows (CRLF) and Linux/Mac (LF) line endings count as the same, and so does a missing line break at the very end. The Side by side view needs a screen at least 760 pixels wide; on narrower screens the result is shown in one column. Very long texts that have little in common are compared with a faster method that does not always find the shortest diff; the tool says when that happens.
Questions
Is the text I paste sent to a server?
When is a line counted as "changed" rather than removed and added?
Why does a paragraph I barely edited show up as completely different?
Does it detect lines that were moved?
What does a line like @@ -12,7 +12,8 @@ in the copied diff mean?
patch command.