How to compare two texts
- Paste the original text in the left box and the changed text in the right box.
- Choose By line or By word, and Side by side or Unified view.
- Review the highlighted additions and deletions and copy the unified diff if needed.
What is a text diff?
A text diff (difference) shows exactly what changed between two versions of a text: which lines or words were added, removed or kept. Additions are shown in green with a plus sign and deletions in red with a minus sign.
This tool implements the Myers O(ND) algorithm in JavaScript. It first strips the common start and end of both texts, then finds the shortest edit script for the rest. In line mode, changed line pairs are also compared word by word so you can see the exact edit inside a line. Statistics show added, removed and unchanged lines or words, plus a similarity percentage.
The comparison runs locally in your browser. Nothing is uploaded or stored, and the page works offline once loaded.
Frequently asked questions
How does this text compare tool find differences?
It uses the Myers O(ND) diff algorithm, the same approach used by Git, to find the shortest set of insertions and deletions that turns the original text into the changed text.
What is the difference between line and word comparison?
Line mode compares whole lines and is best for code, lists and configuration files. Word mode compares individual words and punctuation and is best for prose, contracts and articles.
Can I ignore case or whitespace differences?
Yes. Tick Ignore case to treat uppercase and lowercase letters as equal, and Ignore whitespace to ignore extra spaces, tabs and indentation when matching.
Is my text uploaded to a server?
No. The comparison runs entirely in JavaScript in your browser, so confidential text never leaves your device and the tool works offline.
How large can the texts be?
There is no fixed limit. Typical documents of tens of thousands of lines compare in well under a second; extremely large and very different texts may take longer because diff time grows with the number of changes.