WebToolsPlanet
text Tools

Text Diff Checker

Compare two text blocks and see additions, deletions, and changes highlighted line-by-line using the Myers diff algorithm — like Git diff in a browser.

Last updated: March 25, 2026

Client-Side Processing
Input Data Stays on Device
Instant Local Execution

Find this tool useful? Support the project to keep it free!

Buy me a coffee

What is Text Diff Checker?

A text diff (short for "difference") tool compares two versions of a text document and produces a structured output highlighting exactly what changed between them — which lines were added, which were deleted, and which remained the same. This technique is foundational to software development: Git, Mercurial, and SVN all use diff output to show changes between commits and enable selective merging.

The most widely used diff algorithm is the **Myers diff algorithm** (developed by Eugene Myers in 1986), which finds the shortest edit script to transform text A into text B — minimizing the total number of insertions and deletions needed. The algorithm operates on lines for a line-level diff (the standard) or on characters for character-level diffs. The output format: green highlighted lines = additions (in B but not A); red highlighted lines = deletions (in A but not B); unchanged lines = shown in neutral gray. This tool provides side-by-side and unified diff views, mimicking Git's diff --stat and git diff command output without needing a terminal.

How to Use Text Diff Checker

1

Paste your original (before) text into the "Original" panel on the left

2

Paste the modified (after) text into the "Modified" panel on the right

3

Differences are highlighted immediately — green for added lines, red for deleted lines

4

Toggle between "Side-by-Side" (two-column) and "Unified" (single-column with +/- prefixes) view modes

5

Use the "Ignore Whitespace" option to skip differences that are only indentation or trailing spaces

Common Use Cases

  • Comparing two versions of a config file (nginx.conf, docker-compose.yml) to understand what changed before deploying
  • Reviewing changes to a SQL migration script to verify only the intended tables and columns are affected
  • Checking differences between two API response bodies to debug why a response changed unexpectedly
  • Comparing two essays or document drafts to track content changes for editorial review
  • Verifying that a translation of a document (JSON, YAML, XML) preserved the structure with only values changed
  • Comparing two versions of a .env file (with secrets redacted) to identify missing or added environment variables
  • Reviewing changes to a package.json or requirements.txt to understand which dependencies were added or updated
  • Proofreading legal contracts to find the specific clause changes between a draft and a revised version

Example Input and Output

Finding changes between two nginx configuration snippets:

Original vs Modified config
ORIGINAL:
server {
    listen 80;
    server_name example.com;
    root /var/www/html;
}

MODIFIED:
server {
    listen 443 ssl;
    server_name example.com www.example.com;
    root /var/www/html;
    ssl_certificate /etc/ssl/certs/cert.pem;
}
Diff output (unified view)
  server {
-     listen 80;
+     listen 443 ssl;
-     server_name example.com;
+     server_name example.com www.example.com;
      root /var/www/html;
+     ssl_certificate /etc/ssl/certs/cert.pem;
  }

Summary: 2 lines deleted | 3 lines added | 2 lines unchanged

Client-Side Processing

All text comparison runs in your browser using a JavaScript implementation of the Myers diff algorithm. Both text blocks are never transmitted to our servers — important when comparing sensitive config files, credentials, or legal documents.

Git Diff Integration

To compare two files via Git diff (without committing): git diff --no-index file1.txt file2.txt. For a word-level diff: git diff --word-diff file1 file2. To export a patch file: git diff > changes.patch. To apply a patch: git apply changes.patch. The unified diff output this tool produces is patch-compatible — you can copy the diff output and save it as a .patch file for applying with git apply or the Unix patch command.

Line Ending (CRLF vs LF)

Windows uses CRLF (\r\n) line endings; Unix/Mac use LF (\n). If comparing files from different OSes, every line may appear "changed" because of the invisible \r character difference. Enable "Ignore line endings" in the tool settings to normalize CRLF to LF before comparison. In Git: set core.autocrlf=true on Windows to auto-convert on checkout. The .editorconfig rule end_of_line = lf enforces LF across all contributors' editors.

Frequently Asked Questions

How does the Myers diff algorithm work?
The Myers diff algorithm (Eugene Myers, 1986) models text comparison as a graph traversal problem: find the shortest path through a 2D edit graph where each diagonal move represents an unchanged line, a right move represents a deletion, and a down move represents an insertion. Myers proved that the optimal solution (minimum edit operations) can be found in O(ND) time where N is the total lines and D is the number of differences — making it efficient even for large files. Git uses a variant of Myers as its default diff algorithm. The output (unified diff format) is standardized in POSIX.
What is the difference between line-level and character-level diff?
Line-level diff (standard): compares text line by line — a changed word anywhere on a line marks the entire line as changed. This is readable but can be verbose when only small parts of long lines changed. Character-level (or word-level) diff: highlights the exact characters or words that changed within a line. Git uses line-level by default; git diff --word-diff shows word-level. This tool provides line-level diff (matching Git behavior); the "Show inline changes" toggle highlights the specific character differences within changed lines using a secondary comparison.
What does "ignore whitespace" do?
"Ignore whitespace" mode strips leading/trailing whitespace and collapses internal spaces before comparing — so lines that differ only by indentation level or trailing spaces are treated as identical. This is equivalent to git diff -w or diff -b. Use it when: comparing code that was reformatted (indentation changed) but logic wasn't, comparing YAML/JSON files with different indentation styles, or comparing text from different editors with different line ending handling (CRLF vs LF).
Can I use this to compare code files?
Yes. Since this is a text-based diff, it works for any plain text content — code, config files, JSON, XML, SQL, Markdown, CSV. Copy the file content and paste into each panel. For code, the line-level diff clearly shows added/removed lines, similar to a GitHub pull request code review. Note: this tool does not compute structural diffs (e.g., detecting that a function was renamed vs a line being deleted + new line added) — that requires language-specific AST-based diffing tools.
What is unified diff format vs side-by-side?
Unified diff (git diff default): single-column output with + prefix for additions and - for deletions, mixed with unchanged context lines. Compact and good for copy-pasting (patch files use this format). Side-by-side: two columns showing original and modified simultaneously, with differences highlighted in place. Better for human reading of complex changes. Patch format (diff -u): unified diff formatted for applying with the patch command — use this when you need machine-applicable diff output rather than a visual display.
How many characters or lines can I compare?
The Myers diff algorithm runs in O(ND) time. For very large files (hundreds of thousands of lines), the comparison may take a few seconds in the browser. Practical limits: under 10,000 lines each — nearly instant. 10,000–50,000 lines — may take 1–2 seconds. Above 50,000 lines — use a native tool: `diff file1 file2` in a terminal, or VSCode's built-in diff editor (right-click files in Source Control or use "Select for Compare"). For comparing large files routinely, Meld (Linux/Mac) or WinMerge (Windows) are dedicated graphical diff applications.

How This Tool Works

Both text inputs are split into line arrays. The Myers diff algorithm is applied to find the shortest edit script (minimum additions + deletions) to transform lines-A into lines-B. The resulting edit operations are classified as: equal (unchanged), insert (line in B only), delete (line in A only), or replace (a deletion followed by an insertion). Each operation maps to a rendered diff block with the appropriate color highlight. For the inline character diff within changed lines, a secondary character-level Myers diff is run on each changed line pair.

Technical Stack

Myers diff algorithm (O(ND))Line-level and character-level diffUnified and side-by-side view modesClient-side only