Diff Checker
Compare two texts or code blocks side by side. 100% client-side processing.
No data sent to serverRelated Tools
What is a Diff Checker?
A diff checker compares two pieces of text and shows where they differ — additions, deletions, and modifications. The original Unix diff was published by Douglas McIlroy in 1974 (Bell Labs), and the underlying algorithm has been studied for half a century. Modern implementations like Git's diff and most online tools use variations of Eugene Myers's 1986 algorithm ("An O(ND) Difference Algorithm and Its Variations").
How modern diffs work
The problem is finding the longest common subsequence (LCS) between two sequences. Once you know the LCS, everything outside it is either an addition (in B but not in the LCS) or a deletion (in A but not in the LCS). Myers's algorithm runs in O((N+M)D) where D is the number of edits — fast for similar files, slower for completely different ones.
Granularity: line, word, or character
Diff tools work at different granularities. Line-level is the default for source code — easy to read, matches Git's behavior. Word-level helps for prose where edits are within sentences. Character-level is precise but produces noisy output for typical changes. This tool shows line-level diffs with intra-line word highlighting where helpful.
How to Use
- Paste the original text in the left panel.
- Paste the modified version in the right panel.
- The diff updates automatically as you type. Green lines indicate additions (only in the right side), red lines indicate deletions (only in the left side).
- Lines unchanged between the two versions are shown in their original color for context.
- For large files (10k+ lines), give the browser a moment — everything runs locally on your CPU.
Privacy: Comparison runs entirely in your browser using the diff npm package. No text leaves your device — safe for source code, configs, or sensitive documents.
Diff Algorithms
Myers diff (1986)
The default in Git, Mercurial, and most modern diff tools. Finds the shortest edit script (minimum number of additions and deletions) using a graph-search approach. Time: O((N+M)D) where D is the edit distance. Space-efficient with the "linear refinement" variant.
Patience diff (Bram Cohen, 2008)
Improves readability for code by aligning unique lines first (think of card sorting). Better for refactor diffs where Myers can produce confusing alignments. Available via git diff --patience.
Histogram diff
Variant of patience diff with faster matching. Often the best balance of speed and readability for source code, but it's not Git's default — Git's default is still Myers. Enable histogram with git config diff.algorithm histogram or pass --histogram per command.
Hunt-McIlroy (the original)
The 1974 algorithm in original Unix diff. Based on LCS via dynamic programming — O(NM) time. Replaced by Myers in modern tools but historically important.
Practical Use Cases
1. Quick code review
Compare a stash with HEAD or two branches. When GitHub's diff view feels slow or you want a focused side-by-side, paste here for instant local comparison.
2. Config file drift
Compare nginx.conf on staging vs production. Compare package.json between two environments to find inadvertent dependency divergence.
3. Test output debugging
Paste expected output and actual output to find exactly where a snapshot test fails. Faster than scrolling through a long test runner log.
4. JSON / API response diff
Compare two API responses to spot subtle field changes. Pretty-print both first (use the JSON Formatter tool) so the line-level diff is meaningful.
5. Document version comparison
Two drafts of a contract, two README versions, two log snapshots — anywhere you need a quick "what changed?" without opening Git or a Word document.
FAQ
Is there a file size limit?
Processing happens in your browser, so it depends on your device. Most files under 1 MB compare instantly. Files over ~10 MB may freeze the page momentarily — Myers's algorithm slows on highly divergent inputs.
Can I compare code files?
Yes — any plain text including source code in any language. Line-level diffing works well for code. For very long lines (minified JS), break by semicolons first or use a different pretty-printer.
Why does my diff look weird around moved blocks?
Standard diff algorithms see "move" as a deletion + addition. Some tools detect moves explicitly (Git's --color-moved); most don't. If you frequently review move-heavy diffs, look at semantic-diff tools like difft.
Does this handle Unicode and emoji?
Yes. Comparison is byte-aware via UTF-8 — Korean, Chinese, emoji, and accented characters all diff correctly. Note: normalization differences (precomposed vs decomposed characters) will show as differences even when visually identical.
What's the difference between this and git diff?
git diff needs files in a Git repo. This tool compares any two text snippets — paste from clipboard, no files required. Useful for quick comparisons that aren't worth committing.
⚠️ Reference Only
Output is generated based on your input and is provided for reference. Results may vary depending on your specific use case, edge cases, or environment-specific behavior. We do not guarantee accuracy of conversions, validations, or computed values.
Always verify critical outputs against official documentation or production environments. We are not responsible for any decisions or losses based on these tool results.
📖 Related Guides
HTTP Caching — Cache-Control, ETag, and CDN
Production caching patterns. RFC 9111, stale-while-revalidate, the bugs that cost real money.
UUID v4 vs ULID — Which to Choose?
Compare UUID v4 and ULID for distributed systems. Performance, sortability, and use cases.
JWT Anatomy — Header, Payload, Signature
Understand JWT structure, claims, and signing algorithms. Security best practices.