Text Diff
Text diff is a text tool that compares two blocks of text and highlights every addition and deletion between them. It runs a longest-common-subsequence algorithm on the lines, then on the words inside each changed line, color-codes the result, and works on prose, code, JSON, or any plain text. The tool runs in your browser.
Original
Drop a text file or click to choose
Updated
Drop a text file or click to choose
+ 0 added− 0 removed= 0 unchanged
Paste text in both panes above to see the diff.
Dedicated pages
Optimised for specific diff workflows.
How to compare two texts
- Paste the original text into the left panel.
- Paste the new or modified text into the right panel.
- Differences are highlighted automatically, additions in green, deletions in red.
- Scroll through the diff to review all changes between the two versions.
Common uses
- Comparing two versions of a document to find what changed, then counting words and characters to see how the length shifted between versions
- Reviewing edits to a configuration file or code snippet
- Checking whether two text outputs are identical or where they differ. A SHA-256 checksum can quickly confirm two files are byte-for-byte identical
Technical specification
- Algorithm or formula: Line-level Longest Common Subsequence (LCS) algorithm, then a word-level LCS inside each pair of changed lines. Lines that match at the start and end are set aside first. Changed lines are tokenised into words and whitespace, then matched against the other side; tokens absent from the matching are flagged as insertions or deletions.
- Browser API or library: Custom LCS implementation executed in a dedicated Web Worker so the UI stays responsive for large inputs. A comparison that runs longer than 15 seconds is stopped.
- Input limits: The changed region between matching start and end lines is compared up to 12,000 lines on each side and 1.5 MB in total; a larger region is marked as not compared. A very long changed line may be marked as a whole instead of word by word. Text files up to 10 MB can be loaded.
- Output: Inline highlighted diff with additions in green and deletions in red, plus counts of added, removed and unchanged lines. Longer stretches of unchanged lines are folded, keeping three lines of context around each change.
- Known limitations: Highlighting inside a changed line works on whole words, so a single-character change within a word marks the full word.
Frequently asked questions
- How does this tool show the difference between two texts?
- Differences are highlighted inline: additions appear in green, deletions in red. The diff is computed line by line using an algorithm similar to Unix diff, then the words that changed inside each changed line are highlighted. It handles any plain text including code, JSON, XML, and prose. All processing runs in your browser.
- Is my text sent to a server?
- All diffing happens in your browser. Our servers are not involved at any point.
- Can I compare code files?
- Yes. Paste code into either panel. The tool handles any plain text content including code, JSON, XML, and prose.
- Is there a size limit?
- Lines that match at the start and end of both texts do not count toward the limit. The changed region between them is compared when it has at most 12,000 lines on each side and 1.5 MB in total; a larger changed region is marked as not compared instead of being guessed. The diff runs in a Web Worker in your browser, so the page stays responsive.
Related tools
Find & replace
Find and replace text with plain search or regular expressions. Supports case-sensitive and whole-word matching.
Sort lines
Sort lines alphabetically, by length, or shuffle randomly. Remove duplicates and empty lines in one click.
Word counter
Count words, characters, sentences, and paragraphs. All processing runs in your browser.
Hash generator
Generate SHA-256, SHA-512, SHA-1, and MD5 hashes. Verify file checksums locally.
- Background reading: Complete guide to text tools
Reviewed and tested September 30, 2026.