Text Diff
Paste the original and modified text to get a line-by-line diff, counts of added, removed and unchanged lines, and a similarity score; optionally ignore case or whitespace.
Checking two drafts, two configs or two API responses for differences is more reliable line by line than by eye. Paste the two versions side by side and the output is a line-level diff — unchanged, added, removed — with a count of each and a similarity score, plus options to ignore case and ignore whitespace, which answers the question of whether only one thing was changed.
The algorithm is worth understanding: the comparison is based on the longest common subsequence over lines, so an edited line shows up as a removed line plus an added line rather than a single "changed" record — that is how line-level diffing behaves in general, not a fault. Ignoring whitespace is useful for checking whether a reindentation smuggled in a content change; where indentation carries meaning, as in Python or YAML, compare strictly.
Did this tool solve your problem?
Submitting sends the tool name, your input and the current result to the server. Please do not include ID numbers, phone numbers or other private data.
AI assistant It answers using your current input and result
Asking again sends your current input and result to the server once more. Please do not include private data.
How to use
- Paste the original into the left box and the revision into the right.
- Choose strict comparison, or ignore case and/or whitespace.
- Read the line-by-line result and the added and removed counts.
- Check the similarity score, remembering an edited line shows as a delete plus an add.
How it works
How the differences are computed
Both texts are split into lines, then the longest common subsequence (LCS) finds the fewest deletions and insertions to turn the left text into the right. So editing a line shows as "delete old line + insert new line" — two records, not one "modification" — the universal representation of line diffs (git diff works the same way).
What similarity means here
Similarity = unchanged lines × 2 ÷ (left lines + right lines) × 100%. This basis (equivalently 1 − the changed-line share) stays stable across unequal lengths: with 3 left lines, 4 right lines and 2 unchanged, similarity is 2×2 ÷ 7 = 57.14%. Identical texts score 100%.
Why splitting large texts is advised
LCS needs a matrix of left-lines × right-lines, with cost growing by the square of length. So the tool caps each side at 3,000 lines and the matrix at 2.5 million cells — exceeding limits gives a clear notice instead of freezing the page. For bigger files, split them into modules and compare section by section.
Code example
Shell Three common ways to run diff
# Standard line diff (-u prints a unified format that is easier to read)
diff -u old.txt new.txt
# Ignore case and whitespace differences
diff -u -i -w old.txt new.txt
# Count added / removed lines only (handy for batch checks)
diff -u old.txt new.txt | grep -c '^+[^+]'
diff -u old.txt new.txt | grep -c '^-[^-]'
# For word-level comparison use git diff --word-diff — a line-level diff flags the whole line
JavaScript Quick line-level diff in the front end
// Simplified approach: strip the common prefix and suffix — what remains is the changed region
const diffStat = (a, b) => {
const L = a.split('\n'), R = b.split('\n');
let i = 0;
while (i < L.length && i < R.length && L[i] === R[i]) i++;
let j = 0;
while (j < L.length - i && j < R.length - i &&
L[L.length - 1 - j] === R[R.length - 1 - j]) j++;
return { same: i + j, added: R.length - i - j, removed: L.length - i - j };
};
diffStat('a\nb\nc', 'a\nB\nc'); // { same: 2, added: 1, removed: 1 }
FAQ
How is the similarity computed?
Similarity = matching lines × 2 ÷ (left lines + right lines) × 100% — essentially 1 minus the changed-line share, and valid for unequal lengths. Identical texts are 100%; no overlap is 0%.
Why does editing one line show as a delete plus an insert?
Because the atomic unit of a line diff is the whole line: it never judges "this line was edited", only "this line is present or absent". An edit is therefore a delete of the old line plus an insert of the new one — git diff and most code reviewers show it the same way.
Can ignoring whitespace miss real changes?
Possibly. Ignoring whitespace affects only the comparison key — spaces and tabs inside a line compare as equal — while the output still shows the original text. When indentation itself is the change (Python blocks, Markdown list nesting), use strict comparison instead.
How much text can it compare?
Each side is capped at 3,000 lines, with the product of the two line counts at most 2.5 million (1,500 + 1,500 works; 2,000 + 2,000 exceeds). At the limit the page asks you to split rather than silently producing an incomplete result.
Can it compare two files directly?
The current version compares pasted text only, with no file upload — deliberately: local pasting means nothing is uploaded, and huge files can't freeze the browser. To compare files, open them in an editor and copy-paste.
Are Chinese characters and emoji handled correctly?
Line-level comparison is unaffected. Character-level detail splits by Unicode code points and never breaks emoji surrogate pairs — 😀 is one character, never "half a character" of mojibake.
Are the pasted texts uploaded?
No. The algorithm runs entirely in the browser with no network requests — the server never sees your text. No history is written either; closing the page erases it. Sensitive text is safe to paste.