Text Compare (Diff Checker)
Paste two versions of a text to see exactly what changed.
Comparing two texts
- Paste the earlier version into Original and the newer version into Changed.
- Decide whether small differences should be ignored: "Ignore case" treats upper and lower case as the same, and "Ignore whitespace" collapses runs of spaces and tabs into one space and trims the line ends before comparing.
- Press Compare. The result is only produced when you press the button; editing the boxes does not update it automatically.
- Read the summary, such as "3 added, 1 removed". Lines with a green "+" exist only in the changed text, lines with a red "-" exist only in the original, and unmarked lines are the same in both.
In short
The two texts are compared line by line and the smallest set of added and removed lines is shown; a line with one changed word appears as one removed and one added line. Ignore whitespace also hides invisible spaces such as no-break spaces, but not zero-width spaces, so check for those when two lines look identical.
Frequently asked questions
Is anything uploaded?
No. Everything happens in your browser, and this tool does not upload your files.
Why does a one-word change mark the whole line?
The comparison works on whole lines. Splitting your text into shorter lines, for example one sentence per line, makes the changes easier to pinpoint.
What does "The texts are identical" mean exactly?
With the chosen options applied, every line matched. With ignore options on, the texts can still differ in capitalisation or spacing.
Can it compare files?
Not directly. Open the file in a text editor, copy the contents, and paste them into the boxes.
Our test: how long does a comparison take as texts approach the size limit?
Speed is the question here, so the numbers below come from headless Chromium 153.0.8010.12 on a 4-core 2.1 GHz Intel Xeon server. For the original we took lines of the GNU General Public License version 3, each tagged with a line number so every line was distinct, and for the changed text we edited one line in every 20 (5%). For each size we pressed Compare once to warm up, then timed 15 further presses, including laying out the result. The table shows the median and the slowest press. Every summary matched the edits we made, for example "120 added, 120 removed" at 2,400 lines.
| Lines in each text | Median | Slowest of 15 |
|---|---|---|
| 250 lines | 5.8 ms | 12.6 ms |
| 500 lines | 11.7 ms | 26.0 ms |
| 1,000 lines | 24.4 ms | 67.3 ms |
| 1,500 lines | 41.7 ms | 81.9 ms |
| 2,000 lines | 70.5 ms | 185.1 ms |
| 2,400 lines | 104.8 ms | 170.9 ms |
| 2,449 lines | 99.2 ms | 144.3 ms |
2,449 lines each is the largest pair the size guard accepts; at 2,450 lines each the tool showed its "too long to compare" message instead.
What it means: right up to the limit, a comparison finished in well under a quarter of a second on our machine, so the page stays responsive all the way to the cap. If you hit the message, splitting the text in two halves gives two quick comparisons.
Our test: which differences you cannot see does Ignore whitespace hide?
Two lines can look the same on screen and still be reported as different. To see which of these differences the checkboxes hide, we built 18 pairs of short texts, each pair differing in one way: an extra space or tab, a different kind of space, a zero-width space, a byte order mark, Windows line endings, an extra line break at the end, capital letters, and look-alike characters such as a curly apostrophe or an accent stored as two characters. Using headless Chromium 157.0.8103.78, we pasted each pair into the two boxes through the clipboard, pressed Compare with each of the four checkbox settings, and read the summary line.
| Difference in the changed text | No options | Ignore case | Ignore whitespace |
|---|---|---|---|
| Space or tab added at the end of a line | 1 added, 1 removed | 1 added, 1 removed | Identical |
| Double space, tab instead of a space, or four-space indent | 1 added, 1 removed | 1 added, 1 removed | Identical |
| No-break space (U+00A0) or ideographic space (U+3000) instead of a space | 1 added, 1 removed | 1 added, 1 removed | Identical |
| Byte order mark (U+FEFF) at the very start | 1 added, 1 removed | 1 added, 1 removed | Identical |
| Zero-width space (U+200B) between two words | 1 added, 1 removed | 1 added, 1 removed | 1 added, 1 removed |
| Windows line endings (CR LF) on every line | Identical | Identical | Identical |
| One extra line break after the last line | 1 added, 0 removed | 1 added, 0 removed | 1 added, 0 removed |
| A lower-case first letter, or a whole line in capitals | 1 added, 1 removed | Identical | 1 added, 1 removed |
| Curly apostrophe (’) instead of a straight one (') | 1 added, 1 removed | 1 added, 1 removed | 1 added, 1 removed |
| Non-breaking hyphen (U+2011) instead of a hyphen | 1 added, 1 removed | 1 added, 1 removed | 1 added, 1 removed |
| “café” with the accent stored as a separate mark | 1 added, 1 removed | 1 added, 1 removed | 1 added, 1 removed |
| “Straße” against “STRASSE” | 1 added, 1 removed | 1 added, 1 removed | 1 added, 1 removed |
| “İstanbul” (dotted capital I) against “istanbul” | 1 added, 1 removed | 1 added, 1 removed | 1 added, 1 removed |
With both boxes ticked, every pair gave the same result as with whichever single option hid it, and the pairs that neither option hid stayed different. Similar pairs are grouped into one row; the CSV lists all 18 separately.
What it means: Ignore whitespace also hides space characters you may not know are there, such as the no-break spaces that word processors and web pages sometimes insert, and a byte order mark at the start of a file. It does not hide a zero-width space, which takes no room on screen. If two lines look the same but still show as a minus and plus pair, a zero-width space, a curly apostrophe or an accent stored as two characters is a likely cause. Ignore case does not treat ß as SS or the dotted İ as a plain I, so German and Turkish text can still show differences with it ticked. Windows line endings made no difference in our test because the browser turned each CR LF into a plain line break when the text was pasted; the changed text was 86 characters before pasting and 82 in the box.
All 18 pairs and the summary for each of the four settings are in one plain CSV file with a header row: eighteen pairs at four settings, with columns case, difference, original_chars, changed_chars, changed_box_chars_after_paste, neither_box, ignore_case, ignore_whitespace and both.
More details
Uses
- Check what an editor changed in your document
- Compare two versions of a config file or code snippet
- Spot differences between copied text
How the comparison is calculated
Each text is split into lines, and the tool finds the longest common subsequence of lines: the largest set of lines that appear in both texts in the same order. It builds a table of these lengths and then walks through it to decide, line by line, whether to keep a shared line, mark one as added or mark one as removed. Everything outside the shared lines is reported as a change.
This is a line-based comparison. If you edit a single word inside a line, the old line is shown as removed and the new line as added; the tool does not highlight the individual word. A modified line is therefore always shown as a minus and plus pair.
When the ignore options are on, the comparison uses normalised copies of the lines, but the output always displays your original text, so you can still see the real spacing and capitalisation.
Example: two versions of a short paragraph
Original:
Dear Sam, / Please send the report by Friday. / Thanks, / Alex
Changed:
Dear Sam, / Please send the report by Monday. / Thanks, / Alex
"Dear Sam," "Thanks," and "Alex" are shared, so they appear unmarked. The Friday sentence is shown with a minus and the Monday sentence with a plus: "1 added, 1 removed". If the only change were a capital letter, ticking Ignore case would turn the result into "The texts are identical."
Contracts, drafts, configs and copied text
- Seeing what an editor or colleague changed in an article, contract clause or email draft.
- Checking two copies of a configuration file or code snippet for a stray difference.
- Confirming that two lists or exports you expected to match really do.
- Finding where a pasted copy of a text diverged from the source.
Line endings, long texts and word-level changes
- Differences caused by line wrapping can look bigger than they are. If one version has hard line breaks in the middle of paragraphs and the other does not, nearly every line will differ. Put paragraphs on a single line in both before comparing.
- Ignore whitespace helps with indentation changes and trailing spaces, but blank lines still count as lines.
- Moved blocks are shown as a removal in one place and an addition in another, since the comparison only follows order.
- There is a size guard: the number of original lines multiplied by the number of changed lines may not exceed six million, which is roughly 2,400 lines each. Larger inputs show a message instead of a result. Split a very long document into sections and compare them one at a time.
- Line endings of both Windows and Unix style are handled. When text is pasted or typed into the boxes, the browser stores each line break as a single line feed, so a file saved with Windows line endings compares cleanly against the same text saved on a Mac or Linux machine.