Text Diff Checker
Text ToolsCompare two text blocks — see additions, deletions, and changes highlighted. Free, private — all processing in your browser.
The Text Diff Checker compares two text blocks and highlights exactly what is different — line by line, word by word, or character by character. Paste original text in one panel, modified text in another, and see additions (green), deletions (red), and unchanged sections (gray) in a clean side-by-side view. Use for code review, document revision comparison, editing proofreading, configuration file changes, log file analysis, or any case where you need to understand what changed between two versions of text.
Text diffing has been a foundational developer tool since the 1970s (when diff was first implemented in Unix). Modern tools add visual formatting, word-level granularity, and side-by-side display. This tool uses the Myers diff algorithm — the same algorithm Git uses to produce clean, minimal diffs. Runs entirely in your browser — your text (which may be confidential documents, proprietary code, or sensitive data) stays on your device.
Text Diff Checker — key features
Line, word, and character diff
Choose granularity. Lines for code, words for prose, characters for formatting inspection.
Side-by-side and inline views
Side-by-side for easy visual comparison. Inline for compact single-column output.
Color-coded highlighting
Green = added, red = removed, yellow = modified. Easy to scan.
Ignore whitespace option
Skip whitespace-only changes (indentation, trailing spaces, tabs vs spaces). Focus on content differences.
Case-insensitive comparison
Optional. Treat "Hello" and "hello" as identical. Useful for case-only renames.
Syntax highlighting
Auto-detects common code languages and adds syntax colors on top of diff highlighting.
Export diff as patch
Download as unified diff file (compatible with git apply, patch).
Handles large files
Multi-megabyte texts diff smoothly. Progress indicator for large inputs.
How to use the Text Diff Checker
- 1
Paste original text (left panel)
The before version. Can be code, prose, config, any text.
- 2
Paste modified text (right panel)
The after version. Both panels can be edited after pasting.
- 3
Choose diff granularity
Line for code (default), word for prose, character for detailed inspection.
- 4
Choose view
Side-by-side for easy comparison. Inline for unified diff format.
- 5
Configure options
Ignore whitespace? Case-insensitive? Syntax highlighting? Toggle as needed.
- 6
Review differences
Additions green, deletions red, modifications yellow. Scroll to each change.
- 7
Copy or download
Copy the diff output or download as patch file for use with git apply / patch.
Common use cases for the Text Diff Checker
Code review
- →Compare file versions: Before / after code, see exactly what changed. Perfect for quick PR review.
- →Verify refactoring: After automated refactor (renaming, code formatting), compare to ensure no unintended changes.
- →Rollback check: Comparing to decide if a change should be reverted.
- →Test fixture updates: When test snapshots change, diff shows exactly what is different.
Document editing
- →Editor review: Writer sends draft; editor returns; author compares to see all changes at once.
- →Legal document review: Contracts, terms of service — spot every change between versions.
- →Resume revisions: Compare old and new resume drafts.
- →Translation verification: Compare translated text to source (word-level diff shows where words match/diff).
Config files
- →Environment diff: Compare prod and staging configs. Identify unintended divergence.
- →Before and after infra changes: Show exactly what changed in terraform state, K8s manifests, etc.
- →Config file upgrades: When upgrading a tool (nginx, Apache), compare old and new default configs to see what you need to update.
Debugging
- →Compare working vs broken: Known-working version vs broken version — find the change that introduced the bug.
- →Compare API responses: Expected vs actual API response shows exactly what is wrong.
- →Log comparison: Compare logs from different runs or different servers.
- →Cache vs source: Compare cached version to latest source — find stale data.
Text Diff Checker — examples
Line-level code diff
Function change.
Before:
function hello() {
return "world";
}
After:
function hello(name) {
return `Hello, ${name}!`;
}- function hello() {
+ function hello(name) {
- return "world";
+ return `Hello, ${name}!`;
}Word-level prose diff
Editor changes to a sentence.
Before: The quick brown fox jumps over the lazy dog. After: The slow red cat jumps over the sleeping dog.
Word diff highlights: The [quick→slow] [brown→red] [fox→cat] jumps over the [lazy→sleeping] dog.
Whitespace-only changes
Indentation change.
Before:
if (x) {
return y;
}
After:
if (x) {
return y;
}With ignore whitespace: No semantic differences. Without: all lines marked changed (indentation increased).
Added lines
New code added.
Before:
function a() { return 1; }
After:
function a() { return 1; }
function b() { return 2; }
function c() { return 3; } function a() { return 1; }
+ function b() { return 2; }
+ function c() { return 3; }Removed lines
Code deletion.
Before: import A from './a'; import B from './b'; import C from './c'; After: import B from './b';
- import A from './a'; import B from './b'; - import C from './c';
Config file diff
Port changed in config.
Before: port: 3000 After: port: 8080
- port: 3000 + port: 8080
Unified patch format
Exportable git-compatible patch.
Code change
--- original.js
+++ modified.js
@@ -1,3 +1,4 @@
function hello() {
+ console.log("called");
return "world";
}Technical details
Text diffing is the process of finding differences between two text sequences. The ideal output is a minimal set of changes (additions, deletions) that transforms one text into the other.
Myers diff algorithm (1986):
The standard algorithm used by Git, most IDEs, and this tool. Finds the longest common subsequence (LCS) of the two texts — the longest sequence of characters/lines present in both in the same order. Everything not in LCS is additions or deletions.
Time complexity: O((N+M)D) where D is the length of the diff. Fast for small diffs.
Diff granularity levels:
Line-level diff:
Most common. Compares entire lines as units. If a line changed, shows the old line as deleted and new line as added.
````
- Old line
+ New line
Good for code review, line-oriented files.
Word-level diff:
Finer granularity. Shows exactly which words changed within a line.
````
Before: The quick brown fox
After: The slow red fox
Diff: The [quick→slow] [brown→red] fox
Good for prose, documents, minor edits.
Character-level diff:
Finest granularity. Shows exact character changes. Useful for typos, formatting differences.
Diff output formats:
Unified format (git diff default):
````
@@ -3,4 +3,4 @@
unchanged line
-removed line
+added line
unchanged line
@@ -3,4 +3,4 @@ means: old starts line 3 for 4 lines; new starts line 3 for 4 lines.
Context format:
Older format. Shows removed and added sections with context.
Side-by-side format:
Two panels, aligned. Easy to read but wider. Common in GUI tools.
Inline format:
Single column, differences interleaved. Compact.
Common use cases and challenges:
Source code diffing:
- Line-level is standard.
- Whitespace-only changes often ignored (--ignore-whitespace).
- Color-coded by syntax when possible.
Document revision:
- Word-level more useful than line-level (prose can wrap differently).
- Track changes over paragraphs.
Config file comparison:
- Line-level with context.
- Filter comments.
- Check for semantically equivalent formatting (JSON minify vs pretty).
Log comparison:
- Line-level.
- Filter out timestamps to find actual differences.
- Ignore session IDs, request IDs.
Edge cases:
- Whitespace changes: adding/removing trailing whitespace, converting tabs to spaces, CRLF vs LF. Most tools have "ignore whitespace" option.
- Case changes: Case-insensitive comparison option useful for case-only renames.
- Binary files: Not text; shows "binary files differ" without detail.
- Large files: Diff scales with input size. Multi-MB files may be slow.
Common problems and solutions
⚠CRLF vs LF line endings
Windows uses CRLF; Unix uses LF. Same content with different line endings shows as completely changed. Normalize line endings before diffing, or use option to ignore line ending differences.
⚠Different whitespace counted as change
Trailing whitespace, tabs vs spaces, different indentation widths — all show as changes. Use ignore whitespace option for semantic-only comparison.
⚠Large files slow
Diff algorithms scale with input size. Multi-megabyte files may take seconds. For huge files, compare specific sections or use command-line diff.
⚠Binary files
Diff only works on text. Binary files (images, PDFs, executables) cannot be meaningfully diffed as text. Tools show binary files differ without detail.
⚠Encoding mismatches
UTF-8 vs Latin-1 encoded files may show garbled characters when diffed. Ensure both inputs are the same encoding before comparison.
⚠Diff output interpretation
Unified diff format looks cryptic at first. @@ -3,4 +3,4 @@ means old file starts at line 3 for 4 lines; new file starts at line 3 for 4 lines. Lines with - are removed, + added, space unchanged.
⚠Diff algorithm output differs
Different algorithms (Myers, patience, histogram) can produce different diffs for the same input. Git patience algorithm often gives cleaner diffs for certain patterns. Most tools use Myers.
⚠Renaming misses similarities
Renaming a function is shown as old function removed + new function added. More advanced tools detect renames with similarity score. Git detects renames; most text diff tools do not.
Text Diff Checker — comparisons and alternatives
Text Diff vs JSON Diff: Text diff is character/line comparison. JSON Diff understands structure (see our JSON Diff). For JSON, use JSON Diff — structural comparison is more meaningful than text.
Text Diff vs Code Diff Viewer: Same algorithm, different presentation. Code diff viewers add syntax highlighting. Our Code Diff Viewer targets code specifically.
Side-by-side vs inline diff: Side-by-side is easier to read (two aligned columns). Inline (unified) is more compact and is git default. GUI tools prefer side-by-side; CLI uses inline.
Line vs word vs character diff: Line diff for code. Word diff for prose. Character diff for minor edits. Most diff tools default to line; offer finer granularities as options.
Myers vs Patience vs Histogram diff: Myers (default) is fast and widely used. Patience diff is better for small diffs in large files. Histogram is Git's optimized Myers. Most users do not need to pick — defaults work.
Diff vs Patch: Diff shows differences. Patch applies a diff to transform one file into another (patch -p0 file < diff.patch). Patches are diffs in reverse: produce one, apply the same file to transform.
Frequently asked questions about the Text Diff Checker
▶What is a text diff?
A text diff is a comparison between two texts showing what has been added, removed, or changed. Foundational tool in software development — used for code review, document comparison, log analysis, and anywhere you need to understand differences between two text versions.
▶Is the diff comparison safe?
Yes. Comparison runs entirely in your browser. Both input texts stay on your device. Safe for confidential documents, proprietary code, sensitive configs. Verify with DevTools Network tab.
▶What is the difference between line, word, and character diff?
Line diff treats each line as a unit — useful for code where line is the natural unit. Word diff compares word-by-word — better for prose. Character diff shows exact character changes — useful for typos or formatting details. Choose based on your use case.
▶Why do my identical-looking texts show as different?
Common causes: (1) Line endings (CRLF vs LF), (2) Trailing whitespace, (3) Tabs vs spaces, (4) Invisible Unicode characters (BOM, zero-width spaces). Enable ignore whitespace option or normalize line endings.
▶Can I diff files instead of pasting?
Drop files to upload. Or paste content. Both work. For very large files (multi-megabyte), paste might lag; use desktop tools for those.
▶What does the diff output mean?
In unified format: - prefix = removed line, + prefix = added line, space prefix = unchanged. @@ -3,4 +3,4 @@ = starting at line 3 for 4 lines in old file, line 3 for 4 lines in new file. Context blocks separate different change regions.
▶How do I apply a diff to a file?
Save the diff as a .patch file. Apply with: patch originalfile < changes.patch (Unix) or git apply changes.patch (if it is a git-style diff). Our tool can export git-compatible patches.
▶Can I do word-level diff on code?
Yes, but line-level is usually better for code. Code has meaningful line structure. Word-level within a line is useful to see exactly which variable names changed. Choose based on what you need to see.
▶How large can the input be?
Browsers handle multi-megabyte text without issue. Extremely large inputs (100+ MB) may slow performance. For huge files, use command-line diff or split into smaller chunks.
▶Does the diff algorithm affect results?
Minor differences possible. Myers (default), Patience, and Histogram algorithms can produce slightly different diffs for the same input. All are correct — just different presentations. Myers is the universal standard.
Additional resources
- Myers Diff Algorithm Paper — Original Myers diff algorithm paper (1986).
- diff-match-patch — Google open-source diff library.
- Git diff documentation — Git diff reference with options.
- Unix diff man page — Classic Unix diff command.
- Unified diff format — Specification for unified diff output.
Related tools
All Text ToolsCase Converter
Convert between upper, lower, title, camel, snake, kebab, Pascal, CONSTANT cases
Code Diff Viewer
Compare two code files side by side with syntax highlighting, line-by-line diff, and support for any programming language.
Diff Checker
Compare two text documents side by side with line-by-line diff highlighting for quick change identification.
Find and Replace
Find and replace text with regex support, case sensitivity, whole-word matching, and preview of all changes before applying.
JSON Diff
Compare two JSON objects — find added, removed, and changed properties
Line Counter
Count lines in text with separate totals for blank lines, non-blank lines, words, characters, and paragraphs for detailed statistics.
Learn more
Explore more tools
200+ free tools that run in your browser.
Browse all tools →