Skip to main content

Text Diff

Compare two texts and highlight the differences between them

Original Text

1

Modified Text

1
No differences found
Share:

Spotting the Differences

Comparing two versions of a document by eye is tedious and error-prone. A 'diff' tool automates this process, highlighting exactly what has been added, removed, or changed.

A black and white cartoon of two nearly identical pictures side-by-side, with a few subtle differences circled.A black and white cartoon of two nearly identical pictures side-by-side, with a few subtle differences circled.

How It Works

Diff tools use algorithms to find the 'Longest Common Subsequence' (LCS) between two texts. This allows them to identify the minimal set of changes needed to transform one text into the other.

The LCS Algorithm

Imagine finding the longest string of characters that appear in the same order in both texts. Everything else is treated as an insertion or deletion.

Who Uses This?

  • Programmers

    To track changes in source code (Git diffs) and review pull requests.

  • Writers & Lawyers

    To compare different drafts of a contract or manuscript to ensure no unauthorized changes were made.

A black and white cartoon of a magnifying glass hovering over lines of computer code, revealing hidden changes.A black and white cartoon of a magnifying glass hovering over lines of computer code, revealing hidden changes.

Learn More

Read about the history and algorithms of the Diff utility.