Diff Checker
A diff checker compares two versions of a text and shows exactly what changed. Paste the original on the left and the new version on the right to see added, removed and edited lines, with changed words highlighted. You can ignore case or spacing, and nothing is uploaded from your browser.
Paste two texts above to compare them.
How to use the diff checker
- Paste the original text into the left box and the changed text into the right box, or use Open file to load each from a text file.
- The comparison appears below as soon as you type. Red lines were removed, green lines were added, and a bright highlight marks the words that changed inside an edited line.
- Tick Ignore case or Ignore extra spaces if capitalisation or spacing differences are just noise.
- Switch between Side by side and Inline views, and tick Show only changes to hide long runs of identical lines.
- Use Swap sides if you pasted the two versions the wrong way round.
How the comparison works
The checker works in two passes, the same general approach used by tools such as diff and Git.
- Lines. Both texts are split into lines and the checker finds the shortest list of line insertions and deletions that turns the original into the changed text. It uses the Myers algorithm, which finds a minimal set of edits instead of just any set, so unchanged lines are matched up wherever possible.
- Words. When a removed line sits directly beside an added line, the pair is treated as an edited line. The words and punctuation inside the two lines are compared the same way, and the ones that differ are highlighted.
Ignore case lowercases both sides before comparing. Ignore extra spaces trims each line and collapses runs of spaces and tabs into one. In both cases the lines are still shown exactly as you typed them.
If two texts are almost entirely different, with thousands of separate edits, the checker stops looking for matches and shows the differing section as one removed block followed by one added block. A paragraph that was moved shows up as removed in one place and added in another, because the comparison follows line order.
Worked example
Compare these two lists.
Original
apples bananas cherries dates
Changed
apples blueberries cherries dates elderberries
The result, in inline form, where “-” is removed, “+” is added and a plain line is unchanged:
apples - bananas + blueberries cherries dates + elderberries
That is 2 lines added, 1 removed and 3 unchanged. “apples”, “cherries” and “dates” match; “bananas” was replaced by “blueberries”; and “elderberries” was added at the end.
How to read the results
| You see | It means |
|---|---|
| Red background, left side (or a line starting with “-”) | The line is in the original text but not in the changed text. |
| Green background, right side (or a line starting with “+”) | The line is in the changed text but not in the original. |
| Bright highlight inside a red or green line | The specific words or characters that differ within an edited line. |
| No colour | The line is the same in both texts. |
| “N unchanged lines” bar | A run of identical lines hidden by Show only changes. Three lines of context are kept around each change. |
Frequently asked questions
What is a diff checker used for?
To see what changed between two versions of a text: edits to a document, a contract revision, two copies of a configuration file, or a rewrite someone sent back. It saves you from reading both versions side by side and spotting the differences by eye.
Does it compare lines or words?
Both. It matches whole lines first. For any line that was edited rather than added or removed, it then highlights the individual words and punctuation that changed.
How do I ignore capitalisation or spacing differences?
Tick Ignore case to treat upper and lower case letters as the same, and Ignore extra spaces to ignore leading and trailing spaces and differences in the amount of space between words. Lines that match under those options are shown as unchanged.
Why does a moved paragraph show as deleted and added?
The comparison follows the order of lines. If a block moves to a different place, it appears in the old position as removed and in the new position as added. This is also how Git and other diff tools treat moves.
Can I compare files?
Yes, as long as they are plain text. Use Open file above each box to load a .txt, .md, .csv, .json or .html file. The file is read by your browser and is not uploaded. Word documents and PDFs need to be copied out as text first.
Is my text uploaded or stored?
No. Both texts are compared on your device and nothing is sent to a server, so it is fine to compare private drafts.
Related tools
- Word CounterLive word, character, sentence and paragraph counts, reading time and keyword density.
- Case ConverterSwitch text between upper, lower, title, sentence, camelCase, snake_case and more.
- Remove Line BreaksJoin broken lines into one paragraph, with options for paragraphs and hyphens.
- Duplicate Line RemoverDelete repeated lines and keep one copy, or keep only the unique ones.
- Online NotepadA plain notepad that autosaves in your browser, with copy and .txt download.
Guides
Sources and references
- Myers, E. W. (1986). An O(ND) difference algorithm and its variations. Algorithmica, 1(2), 251-266 — the algorithm used to find a minimal set of edits
- Wikipedia: Diff — background on diff utilities and how differences are presented