Text Diff

Compare two blocks of text and highlight added, removed, and unchanged lines side by side.

Original Text
Modified Text

Frequently Asked Questions

This tool uses a line-level Longest Common Subsequence (LCS) algorithm — the same basis as the Unix diff command. It finds the largest set of unchanged lines and marks the rest as added or removed.

Lines highlighted in green (prefixed with +) are present in the modified text but not in the original. Lines in red (prefixed with ) were in the original but removed. Unchanged lines are shown without color.

This is a line-level diff. Each line is treated as an atomic unit — if a single character changes, the entire line is shown as removed and re-added. This is the standard behaviour of git diff and the Unix diff utility.

A character-level diff shows the exact characters that changed within a line, making small edits very precise. A word-level diff compares whole words, making prose edits easier to read. A line-level diff (what this tool uses) treats each line as a unit — ideal for code and structured data. Tools like git diff --word-diff offer word-level highlighting on top of a line-level base.

The Longest Common Subsequence (LCS) algorithm finds the largest set of lines that appear in the same order in both texts without being adjacent. Lines in the LCS are marked as unchanged; everything else is marked as added or removed. It uses dynamic programming with an m×n matrix (where m and n are line counts), giving O(mn) time complexity. Very large texts may be slower to process.

In code review, a diff shows exactly what changed between the original and modified version of a file. This tool is useful when you want to compare a snippet or config file without running git diff. Paste the old version on the left and the new version on the right to see added lines in green and removed lines in red — the same convention used by GitHub, GitLab, and Bitbucket pull request views.

Unified diff format (used by git diff and diff -u) shows changes in a single output block: lines prefixed with - are removals, lines with + are additions, and context lines (unchanged) have no prefix. Hunk headers like @@ -1,5 +1,6 @@ indicate line number ranges. This tool uses a similar inline format with color coding instead of the @@ header syntax.

By default, a line with only whitespace changes (extra spaces, trailing tab) is shown as a full removal and addition, just like any other change. Enable Ignore leading/trailing whitespace to suppress these cosmetic differences. This is useful when comparing code that has been reformatted or copied from a source that adds or removes indentation.

This tool is a read-only diff viewer — it does not support interactive merging. To merge, you would need to manually copy the lines you want from each version. For full merge capabilities, use git merge, a three-way merge tool like Meld or KDiff3, or the diff/merge feature built into editors like VS Code or IntelliJ. This tool is best suited for quickly spotting changes, not for conflict resolution.

Lines prefixed with + (shown in green) are present in the modified text but not the original — they are additions. Lines prefixed with (shown in red) were in the original text but are gone from the modified version — they are removals. Unchanged lines appear without a prefix and without color. The line numbers show original (left) and modified (right) positions.

About This Text Diff Tool

This free text diff tool compares two blocks of text line by line and highlights additions, deletions, and unchanged lines — similar to the output of the Unix diff command. Differences are colour-coded for quick review, and all comparison happens in your browser.

Spotting exactly what changed between two versions of a file, config, or API response is faster with a visual diff than reading both versions in full. This is the same core operation used by version control systems like Git.

When to use this tool

  • Comparing two versions of a config file, script, or document
  • Spotting changes in an API response after a deployment
  • Reviewing document revisions or draft iterations
  • Identifying which lines differ between two data exports

Standards & References

How It Works

Paste Both Versions

Enter the original text in the left panel and the revised version in the right panel. The diff updates in real time as you type.

LCS Algorithm

The tool uses a Longest Common Subsequence (LCS) algorithm — the same basis as Unix diff — to identify the minimal set of added and removed lines.

Color-coded Output

Green lines are additions (+), red lines are removals (−), and neutral lines are unchanged. A summary shows total added/removed/unchanged counts.

Common Use Cases

Document Version Comparison

Compare drafts of contracts, reports, or articles to see exactly what changed between versions, without relying on tracked changes in Word.

Code Review

Quickly compare two versions of a configuration file, script, or snippet outside a full IDE, or before committing to version control.

Translation QA

Compare source and translated strings line by line to verify all segments are present and no lines were accidentally skipped or duplicated.

Editing & Proofreading

Show editors the exact changes made to an article draft. Line-level diff makes it easy to accept or reject individual changes.

Config File Auditing

Compare production and staging config files to find environment-specific differences that could cause deployment bugs.

Plagiarism Spot-check

Compare a submitted piece against an original source to find copied or lightly rephrased passages before publishing or grading.

Related Articles

View all articles
Why Text Diff Tools Work at Line Level (Not Character Level): Edit Distance, Granularity, and the Unified Diff Format

Why Text Diff Tools Work at Line Level (Not Character Level): Edit Distance, Granularity, and the Unified Diff Format

The simplest possible text diff — "what characters changed?" — is the Edit Distance problem, with an O(n×m) solution too slow for document-scale text. This is why practical diff tools work at line level, with a second character-level pass only within changed lines. Here's how granularity (character, word, line, sentence, structural) changes both what's shown and what's computationally feasible, the unified diff format explained, and why structured diffs for JSON/HTML need tree-level comparison rather than line-level.

Jun 18, 2026
How Plagiarism Detection Actually Works: From Exact-Match Shingling to Semantic Similarity, and Why Each Has Limits

How Plagiarism Detection Actually Works: From Exact-Match Shingling to Semantic Similarity, and Why Each Has Limits

Plagiarism-detection software doesn't search for "stolen sentences" — it converts text into mathematical representations (shingles, vectors, embeddings) and measures distance between them. Here's how exact-match shingling catches copy-paste-with-edits but misses paraphrasing, why semantic-embedding similarity catches paraphrasing but can't distinguish "copied" from "independently expressed similarly," and why similarity scores require human judgment to interpret.

Jun 16, 2026
Text Diff in Practice: Legal Redlining, Code Review, and How AI Writing Assistants Show Changes

Text Diff in Practice: Legal Redlining, Code Review, and How AI Writing Assistants Show Changes

Legal document redlining, Git pull request review, Word's Track Changes, and AI writing assistants all use the same diff principle. Here's how each context uses comparison differently, why legal diff needs more than plain text comparison, and how AI tools use diff to show suggested edits.

Jun 11, 2026
How Diff Works: Git, Three-Way Merge, and the Myers Algorithm Behind It

How Diff Works: Git, Three-Way Merge, and the Myers Algorithm Behind It

Git diff, pull request reviews, and three-way merges all run on the Myers diff algorithm. Here's how diff finds the shortest edit between two texts, how to read git diff output, why merge conflicts happen, and how diff applies beyond version control.

Jun 8, 2026
Text Diff — Compare Two Texts and See Exactly What Changed

Text Diff — Compare Two Texts and See Exactly What Changed

Learn how text diff works, the difference between line, word, and character diff modes, how to read unified diff format, and when to use a text diff tool for documents, code, and configuration files.

Jun 6, 2026