Text Diff

Compare two blocks of text and highlight added, removed, and unchanged lines — live, in your browser.

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. A word-level diff compares whole words. 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 LCS algorithm finds the largest set of lines that appear in the same order in both texts. 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, giving O(mn) time complexity. Very large texts may be slower to process.
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. Hunk headers like @@ -1,5 +1,6 @@ indicate line number ranges. This tool uses a similar inline format with color coding.
By default, a line with only whitespace changes is shown as a full removal and addition. Enable Ignore leading/trailing whitespace to suppress these cosmetic differences — useful when comparing code that has been reformatted or pasted from a source that adds indentation.
This tool is a read-only diff viewer — it does not support interactive merging. For full merge capabilities, use git merge, a three-way merge tool like Meld or KDiff3, or the diff/merge feature built into VS Code or IntelliJ.
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 — they are removals. Unchanged lines appear without a prefix and without color.

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.

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

Related Articles

In-depth guides and technical articles.

View all →
Why Git Diff Shows the Same Change Differently Than Other Tools — Myers Algorithm, Patience Diff, and Semantic Diffing
The Myers diff algorithm (used by git diff) finds the minimum edit sequence with fewest edit groups — not just minimum edits — because multiple minimum-edit solutions exist and some are far more readable than others. Here's why patience diff wins for code by anchoring on unique lines first, how AST-based semantic diffing represents a renamed variable as one change instead of N lines, and why diff3 merge conflict markers (showing the common ancestor alongside both conflicting versions) make conflicts easier to resolve.
Why Git Merge Conflicts Occur Exactly Where They Do — Three-Way Merge, diff3, and Semantic Conflicts
Three-way merge — Git's algorithm for combining two branches — uses a third input (the common ancestor) to determine who changed what, enabling automatic combination when edits don't overlap. Here's why merge conflicts occur exactly where they do (both sides changed the same region), the diff3 conflict format that shows the base alongside ours/theirs, why "no merge conflicts" doesn't mean the code is correct (semantic conflicts), and why "ours" and "theirs" flip meaning between git merge and git rebase.
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.
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.
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.