Home/Text tools/Text diff

Text tool

Text Diff

Paste an original and a revised version, and see exactly which lines were added, removed or left alone — the same line-matching approach source-control tools use.

0Lines added
0Lines removed
0Lines unchanged
Line

How this diff finds what changed

The tool looks for the longest common subsequence (LCS) between the two texts — the longest run of lines that appear in both, in the same relative order, even if other lines sit between them. Every line in that shared subsequence is marked unchanged; everything else is a removal from the original or an addition in the revision.

Think of it like two people reading down two lists, only writing down a line when it appears in both lists in the order they are reading. What is left over — the lines each reader skipped — is what actually changed. This is the same core idea used by git diff and most word-processor "track changes" line comparisons.

Why a moved paragraph shows as delete-plus-add

Line diffing has no concept of "this paragraph moved". It only knows about position within the sequence of lines. If a paragraph is cut from the top of a document and pasted at the bottom, the LCS algorithm sees a line that vanished from its old position and an identical line that appeared at a new one — it has no mechanism to link the two, so it reports one deletion and one addition, even though the content is byte-for-byte the same.

This is not a bug in this tool specifically — it is a structural limit of line-based diffing in general. Tools that detect "moves" as a separate category (some IDEs do this) are running an extra similarity pass on top of the diff, matching near-identical blocks after the fact. A plain line diff, including this one, will not do that.

Questions people ask

Does this compare word by word, or line by line?

Line by line. If a single word changes inside an otherwise identical paragraph, the whole line is marked as one removal and one addition, because the two lines are no longer identical as complete lines.

What does "ignore whitespace" actually ignore?

It trims leading and trailing spaces from each line and collapses internal runs of blank lines before comparing, so a line that only differs by trailing spaces, or a paragraph gap that grew from one blank line to two, shows as unchanged instead of as a false difference.

Can I diff two files instead of pasted text?

Not directly — there is no file upload here, by design, since nothing on this site is sent anywhere. Open a file in a text editor, copy its contents, and paste into either box.

Why does a single-character change mark the whole line?

Because line-based diffing compares whole lines for equality, not individual characters. A line diff cannot express "this line is 95% the same" — a line either matches exactly or it counts as a full removal and a full addition.

Comparing text for somewhere else?

Find and replace, whitespace cleanup and sorting sit right next door.

See all text tools →