± Text Diff Checker
Compare two blocks of text side by side and see differences highlighted. Line-by-line and word-level diff view. Free online text diff tool — no signup, works in browser.
How to Use
Paste your texts
Paste the original text in the left box and the modified text in the right box.
Click Compare
Press Compare to instantly highlight all additions, deletions, and unchanged lines.
Read the results
Green lines are additions, red lines are deletions, grey lines are unchanged.
Frequently Asked Questions
Complete Guide: Text Diff Tool
A diff tool compares two versions of text and highlights what has changed — additions, deletions, and modifications. Whether you're reviewing a colleague's edits to a document, debugging a configuration change, or proofreading a legal contract, a well-designed diff view makes changes immediately visible.
Diff Granularity: Line, Word, and Character
Diff algorithms operate at different levels of granularity, each suited to different use cases:
- Line-level diff — Compares entire lines. Standard output of
git diff. Best for code, where lines are the logical unit of change. - Word-level diff — Compares individual words within changed lines. Closer to how humans perceive edits in prose. Use git diff --word-diff on the command line.
- Character-level diff — Highlights individual character changes within words. Most precise. Best for catching subtle edits like number changes, typo corrections, or single-character differences.
The Myers Diff Algorithm
The most widely used diff algorithm is the Myers algorithm, published by Eugene Myers in 1986. It finds the shortest edit script — the minimum number of insertions and deletions needed to transform one text into another. It runs in O(ND) time, where N is the total length of both texts and D is the number of differences.
The Myers algorithm is used by git diff, GNU diff, and most diff libraries. Its output is the standard unified diff format:
--- original.txt
+++ modified.txt
@@ -1,4 +1,4 @@
This line is unchanged.
-This line was removed.
+This line was added.
Another unchanged line.
Levenshtein Distance for Fuzzy Matching
Levenshtein distance measures how many single-character edits (insertions, deletions, substitutions) are needed to change one string into another. Unlike Myers (which aligns sequences), Levenshtein gives a numerical similarity score useful for fuzzy matching — finding near-duplicate lines that have been partially reworded. A Levenshtein distance of 0 means identical; lower numbers mean more similar.
Ignoring Whitespace
When reviewing reformatted code or documents where only indentation changed, whitespace-ignoring diffs are invaluable. In git diff, use -w to ignore all whitespace changes or --ignore-space-change (-b) to ignore changes in the amount of whitespace:
git diff -w HEAD~1 HEAD -- config.json
Use Cases
- Legal documents — Track changes between contract drafts. Character-level diff catches subtle word substitutions that change meaning.
- Proofreading workflows — Compare an author's original with an editor's revisions to see exactly what was changed.
- Configuration management — Diff server config files before and after deployments to audit changes.
- API response comparison — Compare JSON payloads from two API versions to spot breaking changes.
Programmatic Diffing in Node.js
The diff npm package provides Myers-algorithm diffing for JavaScript with multiple granularity modes:
const Diff = require('diff');
const one = 'The quick brown fox';
const two = 'The fast brown dog';
const changes = Diff.diffWords(one, two);
changes.forEach(part => {
if (part.added) process.stdout.write('\x1b[32m' + part.value + '\x1b[0m');
else if (part.removed) process.stdout.write('\x1b[31m' + part.value + '\x1b[0m');
else process.stdout.write(part.value);
});
- Use the Diff Checker for side-by-side visual comparison.
- For structured data comparison, try JSON Diff which understands JSON structure.