Free Diff Checker — Compare Text Online

Paste two versions of a text and see the differences side by side. Comparison runs locally — nothing is uploaded.

What "longest common subsequence" actually means

The core problem in any line-based diff is finding the largest set of lines that appear, in the same relative order, in both texts — that set is the "longest common subsequence" (LCS), and everything not in it gets marked as either removed or added. This is the same underlying idea git uses to compute file diffs and merge conflicts. It's a dynamic-programming problem, and the table involved grows with the product of both texts' line counts — which is why this tool automatically falls back to a faster, simpler line-by-line comparison on very large inputs rather than letting that table become too large to compute quickly.

Where this is useful beyond code

Frequently Asked Questions

How does the diff algorithm work?

The tool computes the longest common subsequence (LCS) of lines between the two texts — the same core idea used by git and classic diff utilities. Lines only in the original are marked removed (red); lines only in the changed version are marked added (green).

Is my text sent to a server?

No. The comparison runs entirely in your browser with JavaScript. It is safe to diff confidential documents, contracts, or source code.

Can I ignore whitespace differences?

Yes — check "Ignore leading/trailing whitespace" and lines are compared after trimming, so indentation-only changes are not flagged.

Does this compare individual words, or whole lines?

Whole lines. If a single word changes in the middle of a long line, the entire line is marked as removed and re-added rather than highlighting just that word — for word-level precision, keep lines short or break text into one sentence per line before comparing.

Does it detect when a block of text was moved rather than changed?

Not as a distinct category — a moved block shows up as a deletion at its old position and an identical addition at its new position, since LCS-based diffing doesn't have a separate concept of "moved." You can usually recognize a move by spotting matching red and green blocks elsewhere in the output.

Is there a size limit?

Texts up to a few thousand lines each compare instantly. For very large inputs the tool automatically switches to a faster line-by-line comparison to stay responsive.