Text Diff Tool
Compare two texts and find differences instantly. Line-by-line and word-by-word comparison with highlighted changes.
About This Tool
Text Diff compares two blocks of text and highlights the exact differences between them at the line and character level. It supports side-by-side and unified diff views, making it easy to spot additions, deletions, and modifications. Ideal for code reviewers, writers comparing document revisions, and anyone who needs to identify changes between two versions of text.
How to Use
- Paste your original text in the left textarea.
- Paste the modified text in the right textarea.
- Click “Compare” to see differences highlighted by color.
- Toggle between Line and Word comparison modes for different detail levels.
- Use “Swap” to switch the original and modified texts.
FAQ
How does the text comparison work?
It uses the LCS (Longest Common Subsequence) algorithm to find common parts between two texts and identify added, removed, and modified lines. All processing happens in your browser.
Can I compare large texts?
Yes, you can. However, extremely large texts (tens of thousands of lines) may affect browser performance. It works well for typical documents and code comparisons.
What is the difference between line and word comparison?
Line comparison treats each line as a unit. Word comparison additionally highlights which specific words changed within modified lines.
Is my text stored anywhere?
No. All comparisons are processed locally in your browser. No data is sent to or stored on any server.
Related Tools
How It Works
This tool implements the Myers diff algorithm, the same algorithm used by Git. The algorithm finds the shortest edit script (SES) — the minimum number of insertions and deletions needed to transform one text into another. It operates on an edit graph where the x-axis represents the original text and the y-axis represents the modified text. Diagonal moves represent matching characters (no change), horizontal moves represent deletions, and vertical moves represent insertions.
The algorithm works by exploring edit paths of increasing distance (d = 0, 1, 2, ...) using a greedy approach that extends each path as far as possible along diagonals (matching sequences). This finds the longest common subsequence (LCS) as a byproduct. Once the shortest edit path is found, it is traced back to produce the diff output. For character-level highlighting within changed lines, a second pass runs the diff algorithm on the individual characters of each modified line pair, enabling precise intra-line change visualization.
Related Articles
Markdown Syntax Cheat Sheet: The Complete Guide for Developers and Bloggers
Complete Markdown syntax reference with examples. Learn headings, lists, links, images, code blocks, tables, and advanced formatting.
2026-03-15Online Diff Checker: How to Compare Text, Code & Documents Instantly
Free online diff checker to compare two texts side by side. Highlights differences line-by-line or word-by-word. No signup, no installation. Try it now.
2026-03-26Word Counter Guide: How to Count Words, Characters & Reading Time 2026
Learn the differences between characters, words, and bytes. Master SNS character limits, reading time estimation, and keyword frequency analysis with our comprehensive guide.