Diff Checker

The Complete Diff Checker Guide

How text diffing algorithms actually find what changed, where diffing gets used, and how to read colored +/- output like a pro.

Open Diff Checker

What a Diff Algorithm Does Conceptually

At its core, a diff algorithm answers one question: what is the smallest set of edits that turns the original text into the changed text? It does this by splitting both texts into lines and finding the longest common subsequence (LCS) - the largest group of lines that appear in both texts, in the same relative order (though not necessarily adjacent to each other).

Everything that falls inside that shared subsequence is treated as unchanged context. Everything outside it must have either been removed from the original or added in the changed version. This is why diffing produces genuinely meaningful results rather than just flagging every line that moved position - it's specifically hunting for the smallest possible explanation of the difference between two texts, which is exactly what Git, Word's "Track Changes," and this tool all do under the hood.

Common Use Cases

Comparing Document RevisionsSee exactly which sentences changed between two drafts of an article, contract, or policy document without re-reading the whole thing.
Code ReviewCheck what a colleague actually changed in a snippet or file before merging, especially when you're outside your normal version control workflow.
Spotting Config ChangesConfirm exactly what changed in a config, environment, or settings file between two deployments or environments.

How to Read the +/- Colored Output

MarkerColorMeaning
-Red / pink backgroundLine exists only in the Original text - it was removed
+Green backgroundLine exists only in the Changed text - it was added
(none)No backgroundLine appears in both texts unchanged, shown for context

Reading a diff top to bottom tells the story of the edit: unchanged lines anchor your place in the document, while - and + lines immediately show you what was taken out and what replaced it. If a line was only edited slightly, it will usually show up as a matching - / + pair right next to each other, since the two versions of that line no longer count as identical.

Frequently Asked Questions

How does a diff algorithm decide what actually changed?

It computes the longest common subsequence (LCS) between the two texts - the largest set of lines that appear in both, in the same relative order. Anything outside that shared sequence is a true addition or removal, not just a coincidence of matching text.

Why do diff algorithms use longest common subsequence instead of just comparing line 1 to line 1, line 2 to line 2, and so on?

A naive position-by-position comparison would treat every line after a single inserted line as "changed", since everything shifts down by one. LCS instead searches for the best alignment between the two texts, so a single insertion or deletion shows up as exactly one addition or removal, and every other line is still recognized as unchanged even though its line number moved.

What do the + and - symbols mean in the output?

A line marked with - and a red/pink background exists only in the original text (it was removed). A line marked with + and a green background exists only in the changed text (it was added). Unmarked lines appear in both and are shown unchanged for context.

Why does moving a block of text show as removed and added instead of moved?

A line-based LCS diff only tracks whether lines appear in the same relative order, not whether a block was relocated. If a paragraph moves elsewhere in the document, it typically appears as a removal at its old position and an addition at its new one.

What's the difference between a "diff" and a "patch"?

A diff is a human-readable description of what changed between two versions of a text. A patch is that same information formatted so a tool - like the Unix `patch` command or `git apply` - can programmatically replay the same changes onto another copy of the original file. This tool shows you a diff view for reading and reviewing; it doesn't generate an applicable patch file.

Why does a single character change highlight the whole line?

This diff compares whole lines, not individual characters. If even one character differs, the two lines are not identical, so the algorithm treats the old line as removed and the new line as added rather than showing a partial, in-line edit.

Open Diff Checker