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
Find this tool useful? Support the project to keep it free!
Buy me a coffeeWhat 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
Paste your original (before) text into the "Original" panel on the left
Paste the modified (after) text into the "Modified" panel on the right
Differences are highlighted immediately — green for added lines, red for deleted lines
Toggle between "Side-by-Side" (two-column) and "Unified" (single-column with +/- prefixes) view modes
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:
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;
} 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 unchangedClient-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?
What is the difference between line-level and character-level diff?
What does "ignore whitespace" do?
Can I use this to compare code files?
What is unified diff format vs side-by-side?
How many characters or lines can I compare?
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