πŸ” Text Diff

Compare two texts and highlight added, removed, and changed lines.

Original Text (A)
New Text (B)

How to Use This Tool

Paste your original text into the left panel and your revised text into the right panel. Click Compare to see the differences highlighted line by line. Green lines are additions, red lines are removals, and unmarked lines are unchanged.

1

Paste the original version of your text into the Original Text (A) panel on the left.

2

Paste the updated version into the New Text (B) panel on the right.

3

Click Compare to run the diff and view highlighted changes below.

4

Read the summary: added lines in green (+), removed lines in red (-), and unchanged lines in white.

How the LCS Diff Algorithm Works

This tool uses the Longest Common Subsequence (LCS) algorithm, which is the same algorithm behind the Unix diff command and Git's line-by-line diff output. LCS finds the largest set of lines that appear in both texts in the same relative order without necessarily being contiguous. Everything not in that common subsequence is either an addition (present in B but not A) or a deletion (present in A but not B). The result is a minimal diff: it shows the smallest number of changes needed to explain the difference between the two versions. In practice, if you moved a paragraph from the top to the bottom of a document, LCS will show it as a deletion at the top and an insertion at the bottom, not as a "move" operation, because true move detection requires semantic understanding. For code review purposes this is exactly the behavior you want: it matches what GitHub's diff view shows. Paste two versions of a contract clause, a config file, a README section, or any structured text to instantly see what changed between them.

Common Use Cases

Document version comparisonCompare two drafts of a contract, policy, or spec to find edits
Config file changesDiff two versions of nginx.conf or package.json to spot what was modified
ProofreadingCompare a client's revised text to the original to see exactly what they changed
Code snippet comparisonCompare a function before and after refactoring to review the changes

Frequently Asked Questions

What is a text diff?

A diff (difference) shows the changes between two versions of text: additions (new content), deletions (removed content), and unchanged lines.

How does line-by-line diffing work?

Each line of text A is compared to text B. Lines only in A are marked as removed (red). Lines only in B are marked as added (green). Matching lines are shown as unchanged.

Can I compare documents?

Copy and paste text from any document (Word, PDF, code file, etc.) into each panel. The comparison is done on the pasted text content.

What is a git diff?

Git diff is a version control command that shows changes between file versions using the unified diff format: + for added lines, - for removed lines.

Is this similar to file comparison tools?

Yes β€” this is a simplified text-based version of tools like Beyond Compare, WinMerge, or the GitHub file diff view, all in your browser without any installation.