Text Diff & Compare — Line and Word Comparison
Compare two blocks of text and see every added and removed line or word — a line diff for code, a word diff for prose, all on your device.
—
What this tool does
Comparing two versions of a text by eye is unreliable: a single changed character in a long paragraph is easy to miss and easy to misread as unchanged. A diff does the comparison mechanically and shows you only what is different. This page offers both granularities — a line diff for structured text such as code, configuration and logs, and a word diff for prose — and renders the result either as unified output you can paste, or as a side-by-side read.
How to read the output
| Marker | Meaning |
|---|---|
- | A line (or word) present in the original but not in the changed text — removed |
+ | A line (or word) present in the changed text but not the original — added |
| two spaces | Unchanged context, kept so nearby changes are readable |
@@ … | A run of unchanged lines collapsed away to keep the view short |
Line diff or word diff?
The right choice follows the kind of text. For code, a line diff is the only sensible view — an edit almost always changes a whole line, and word-level noise would obscure the structure. For a paragraph of prose, the opposite holds: a line diff would highlight the entire paragraph because one word changed, while a word diff points at the word. If you are unsure, try the line view first and switch to word when the changes look too coarse.
Why a diff matters
Beyond reviewing code, a diff is a checking tool. It confirms that a find-and-replace did exactly what you intended and nothing more, that a copy-paste between two documents carried no hidden changes, that a configuration edit differed only in the line you meant to touch, or that an "identical" file really is identical. It turns "I think these are the same" into a definite yes or no, with the differences spelled out.
Frequently asked questions
Does the diff ignore whitespace?
The page compares exactly what you paste. Leading and trailing spaces, tabs versus spaces, and line-ending differences all count as changes unless you normalise the input first. For code reviews that is usually the honest behaviour — a whitespace-only change is still a change — but for prose pasted from two different editors, trim or normalise both sides before comparing.
What does “linearised” mean in the result?
For very large inputs, an exact line-by-line diff is quadratic in time and memory, so the engine first trims the common start and end and, if what remains is still too large, replaces the middle with one remove and one add rather than computing every alignment. The result stays correct as a description of the change, but it is coarser than an exact diff; the page says when that happened instead of silently returning a misleading alignment.
Can it compare Word documents or PDFs?
No. It compares the text you paste, so a .docx or .pdf has to be converted to text first; the result then reflects the converted text, not the layout. For structured documents the conversion can reorder or drop elements, so check the extracted text before treating a diff as the whole story.
How does a text diff work?
A diff finds the longest common subsequence of the two texts — the largest set of lines (or words) that appear in the same order on both sides — and reports everything outside it as an addition or a deletion. The result is the smallest set of edits that turns one text into the other, which is why diff tools show you changed lines rather than the whole file.
What is the difference between a line diff and a word diff?
A line diff compares whole lines and is what you want for code, configuration files and logs — it shows which lines changed. A word diff compares word by word within the text and is what you want for prose, where a single word changed inside a paragraph and highlighting the entire paragraph would be noise. Switch between them with the mode selector.
What does the unified output look like?
Unified format marks removed lines with a leading minus, added lines with a leading plus, and unchanged context lines with two spaces, exactly as the diff and git commands produce. Long stretches of unchanged text are collapsed to a @@ … marker so the changes stay readable. It is the format to paste into an issue or a code review.
Is the diff symmetric?
Yes. Swapping which text is on the left and which is on the right swaps every addition for a deletion and vice versa, but the set of changes is the same. Which side you call "old" only changes the direction of the arrows, not what actually differs.
How large a text can it handle?
For ordinary files, documents and code snippets it is instant — the common head and tail of the two texts are matched directly, so two versions of a long file that differ in one spot stay fast. Only when both texts are huge and almost entirely different does the exact line-by-line alignment get skipped: the changed region is then shown as one removed block and one added block, and the page says so. Either way it never loads the browser down or runs out of memory.
Is my text uploaded?
No. The comparison runs entirely in your browser; neither text is sent anywhere. That matters when the text carries credentials, customer data or anything you would not paste into a server-based diff site.
Go deeper
Longer explanations of the problems this tool solves:
Everything runs in your browser — nothing you type is uploaded.