How to Compare Two Texts for Differences

Comparing two versions of a text is a solved problem: a diff tool aligns the two and marks what was added and removed. The skill is in reading the result without mistaking a reformatted paragraph for a rewritten one.

How a diff works

The tool finds the longest common sequence of lines between the two versions and marks everything outside it as added or removed. That is why a single changed word can appear as a whole line removed and a whole line added.

The output is accurate but coarse. Reading it requires knowing that a line marked removed and immediately replaced is usually one small edit, not a deletion plus an insertion.

Paste both versions to see what changed.

Open the Text Difference Checker →

Line, word and character comparison

ModeBest forNoise level
LineCode, structured documentsHigh for prose
WordEdited prose, contractsLow
CharacterSpelling and punctuation checksVery low

For a contract or an article, word-level comparison is far easier to read. For code, line-level is standard because line structure carries meaning.

Whitespace and line endings

A paragraph reflowed across different line breaks looks like a total rewrite in a line diff and is identical in a word diff. Similarly, Windows and Unix line endings make every line different.

Normalise whitespace before comparing prose, and treat a reflow as no change at all.

Reading the output

Unchanged text is plain. Removed text is marked one way and added text another. Read the pairs: a removed line followed by an added line with small differences is one edit.

Look at the total counts first. If a comparison reports 40 changes in a document you thought had two, the comparison mode or the whitespace handling is wrong.

Version control uses the same idea

Git diff shows changes between two versions of a file in the same way, and the same reading skills apply. Reviewers read diffs rather than whole files, which is why a large diff is hard to review.

That is a practical argument for small, focused changes: a diff of ten lines gets read carefully, a diff of a thousand does not.

Comparing documents you did not write

When two people supply versions of the same document, a word-level diff shows who changed what. That is useful for merging edits and for spotting changes that were not disclosed.

Keep both originals and save the comparison output. A diff is evidence, and evidence that cannot be reproduced is weak.

Plagiarism and similarity

A diff shows differences, not similarity. To check whether two texts are too alike, you need a similarity measure rather than a line comparison.

A diff is still useful for a spot check: identical sentences with one word changed will show up clearly as near-identical lines.

Common mistakes

A practical workflow

Save both versions with clear names. Normalise whitespace. Run a word-level comparison. Read the first and last change to confirm the comparison is aligned, then work through the middle.

That order catches misalignment early, before you have read a long list of changes that are not real.

When a diff is the wrong tool

If the two texts are genuinely different documents rather than versions, a diff produces noise. Compare structure or key facts instead.

If one is a summary of the other, a diff will show almost everything as different, which tells you nothing useful.

Saving the comparison

Export the comparison output alongside both versions. A diff that cannot be reproduced later is weak evidence if someone disputes what changed.

Name the files with the date and the version, so the record explains itself without a covering note.

Reading a diff well

Start with the summary of how many lines changed, then read the changes in order. A large count with small edits usually means whitespace or line endings differ, not the content.

If both versions came from different editors, normalise line endings and trailing spaces first so the real edits stand out.

For legal or contract text, read the unchanged lines near each change too. Context often shows whether a small edit shifts the meaning.

Frequently asked questions

What is a diff?

A comparison that shows which lines or words were added, removed or unchanged between two versions.

Why does one changed word show as two lines?

Line-based comparison marks the whole old line as removed and the whole new line as added.

Can I compare more than two versions?

Not in one pass. Compare each version against a baseline instead.

Sources

More free tools

Related guides