Text Diff Tool
Compare two versions of any text and see exactly what changed — added, removed and edited lines, with the changed words highlighted, side by side or as a unified diff.
How to Use
- Paste the original into Before and the new version into After. The diff updates as you type.
- Choose the detail: whole Lines, or highlight the changed Words or Characters inside each edited line.
- Switch between Unified (one column, like git) and Side by side.
- Tick Hide unchanged to keep only the changes and three lines around each, and use the ignore options for case and spacing.
- Press Copy as patch for a standard unified diff you can paste into a code review or apply with patch.
Worked Example
Before: apple, banana, cherry (3 lines). After: apple, blueberry, cherry, date (4 lines).
The longest run of lines found in both, in order, is apple, cherry — 2 lines, kept as unchanged.
Everything else is an edit: banana was removed, blueberry and date were added. banana and blueberry sit in the same place, so they are shown as one changed line, and date as a pure addition.
Similarity = 2 × 2 common lines / (3 + 4) lines = 4 / 7 = 57%.
As a unified diff the change is one block: @@ -1,3 +1,4 @@ — 3 lines from line 1 of the old text became 4 lines from line 1 of the new — followed by “ apple”, “-banana”, “+blueberry”, “ cherry”, “+date”.
Show Work
Formulas
Where Diff Came From
The diff program appeared in Unix in 1974, written by Douglas McIlroy, and James Hunt and McIlroy described its algorithm in a 1976 Bell Labs report. Its output became the way programmers exchanged changes: send the differences, not the whole file, and let the patch program apply them on the other end.
In 1986 Eugene Myers published “An O(ND) Difference Algorithm and Its Variations”, which finds a smallest set of changes and runs fastest when two texts are similar — the usual case. It is the default algorithm in git. The unified format, with its @@ headers and +/- lines, was added to GNU diff in 1990 and is now the standard way changes are shown in code review.
About This Tool
This tool compares two texts line by line with Myers’ algorithm, pairs removed and added lines that replace each other, and highlights the exact words or characters that changed inside them. It shows the result as a unified diff or side by side, can hide unchanged lines, and copies the result as a standard patch.
Ignore case and ignore whitespace change only what counts as different; the text shown is always your original. Large texts are handled by trimming the shared beginning and end first, and everything runs in your browser.
Related tools: File Comparer, Text Cleaner, and Character Counter.
Frequently Asked Questions
How does a diff decide what changed?
It finds the longest sequence of lines that appear in both texts in the same order — the longest common subsequence — and keeps those as unchanged. Every other line in Before was removed and every other line in After was added. This tool uses Myers’ algorithm, the default in git, which finds the smallest possible set of changes quickly.
What is the difference between a changed line and a removed-and-added line?
When lines are removed and others added in the same place, the tool pairs them up and shows them as changed, highlighting only the words (or characters) that differ. Lines without a partner stay as pure additions or removals.
What do “ignore case” and “ignore whitespace” do?
They decide what counts as different. Ignore case treats “Hello” and “hello” as the same line. Ignore whitespace treats runs of spaces and tabs as one space and ignores spaces at the ends of lines, so re-indented or re-spaced text does not show up as changed. The text you see is never altered.
What is a unified diff (patch)?
The standard text format for changes, used by git, code reviews and the patch command. Each change block starts with a header such as @@ -3,4 +3,5 @@ — 4 lines from line 3 of the old text became 5 lines from line 3 of the new text — followed by lines marked “ ” (unchanged), “-” (removed) and “+” (added).
Is my text uploaded?
No. The comparison runs entirely in your browser, so it is safe for contracts, private code and configuration files.
How do I use the Text Diff Tool?
Just type your numbers. The answer shows up right away — there is no button to press. Change anything and it updates by itself.
Is it free? Does it work without internet?
Yes to both. It is free with no sign-up, and once the page has loaded it keeps working even with no internet.
Where does my data go?
Nowhere — every calculation runs on your own device. Nothing you enter is uploaded, logged, or stored.
Common Use Cases
Contract and document edits
Compare a draft with the version that came back: word highlights show that “30 days” became “60 days” in clause 4, without reading both copies.
Configuration drift
Diff a working .env or nginx.conf against a broken one; with Hide unchanged on, a 400-line file shrinks to the three lines that matter.
Code without git
Compare two versions of a snippet, then Copy as patch to paste a proper unified diff into a ticket or chat.
Logs before and after
Paste the startup log from before and after a deployment to spot the new warning lines.
Translations and copy
See exactly which words a translator or editor changed in a paragraph, with character detail for small spelling fixes.
Last updated: