Text Diff Tool

Compare two texts and see additions and removals highlighted with line and word diff modes.

Text Diff Tool

A text diff tool compares two blocks of text and highlights the differences between them. It identifies additions, removals, and unchanged sections, making it easy to see what changed between two versions of a document, code snippet, or any text content.

This tool supports both line-level and word-level comparison modes, with unified and side-by-side views. No data is sent to any server — all processing happens in your browser.

How it works

Uses the Longest Common Subsequence (LCS) algorithm to compute the minimal set of additions and removals needed to transform the original text into the modified text.

Use cases

  • Comparing two versions of a document or configuration file
  • Reviewing code changes before committing
  • Checking differences between API responses
  • Verifying text transformations and edits

Frequently asked questions

How do I compare two texts online and see the differences?

Paste the original text into the first box and the modified text into the second, and the tool instantly highlights what was added, removed, and left unchanged. You can switch between line-level and word-level comparison and view the result in a unified or side-by-side layout.

What is the difference between line diff and word diff?

A line diff compares the two texts one line at a time, which works well for code and configuration files. A word diff goes further and highlights individual words that changed inside a line, making it better for prose, essays, or documents where a single line may contain many small edits.

Is it safe to compare confidential documents with an online diff tool?

With this tool, yes — all comparison happens locally in your browser and no data is sent to any server. Your texts never leave your device, so you can safely compare contracts, internal documents, or private code.

How does a text diff algorithm work?

This tool uses the Longest Common Subsequence (LCS) algorithm, which finds the longest sequence of lines or words that both texts share in the same order. Everything outside that shared sequence is then marked as an addition or a removal, producing the minimal set of changes needed to turn one text into the other.

What do the highlights in the diff result mean?

Content that appears only in the modified text is marked as an addition, content that appears only in the original is marked as a removal, and unmarked sections are identical in both versions. In side-by-side view the original is shown on the left and the modified text on the right, so you can scan changes visually.

Related Calculators