Compare two texts and see every change
Two versions of the same text rarely differ in an obvious way. A contract comes back with one sentence reworded, a colleague edits your report, a config file stops working after an update, or two exports of a list should match but do not. Reading both side by side and hunting for the change is slow and you miss things. This diff checker lines the two texts up, marks what was removed in red and what was added in green, and counts every change.
Everything runs in your browser. The texts are not uploaded, so you can safely compare contracts, code, customer lists or anything else that should stay private. Large texts are compared in a background thread, so the page stays responsive even with 10,000 lines.
Compare by lines, words or characters
| Mode | Best for | What counts as one change |
|---|---|---|
| Lines | Code, lists, CSV and log files, poems, anything line by line | A line added, removed or edited |
| Words | Essays, articles, emails, contracts | A word added, removed or replaced |
| Characters | IDs, numbers, names, a missing comma | A letter, digit or symbol added, removed or replaced |
In line mode, a removed line and an added line that share most of their words are shown as one changed line, with the exact words that changed highlighted inside it. Lines that have nothing in common stay separate, as one removed and one added line. Word mode treats punctuation marks as words of their own, so a period that became an exclamation mark counts as one changed word.
Side by side or inline
Side by side puts the original on the left and the changed text on the right, with line numbers for both, which is the easiest way to read a long document. Inline shows one text where removed parts are struck through in red and added parts are underlined in green, which works better on a phone and for short texts. Use Prev and Next to jump from one difference to the next. With Fold unchanged text on, long unchanged stretches collapse into a bar, and three lines of context stay around every change; click the bar to show the hidden lines.
Ignore case, whitespace and blank lines
- Ignore case treats "Total" and "total" as the same, handy for email lists, keywords and SQL.
- Ignore whitespace ignores spaces, tabs and line breaks, so reindented code or a double space after a period does not show as a change. In line and character mode, "a b" and "ab" also count as the same; in word mode they stay different words.
- Ignore blank lines skips empty lines when matching, so an extra blank line between paragraphs does not count. In line mode the skipped lines still show, in gray.
The ignore options only change what counts as different. The result always shows each text exactly as you pasted it.
How the comparison works
Finding differences means finding the longest common subsequence: the largest set of lines, words or characters that appear in both texts in the same order. Whatever is left over in the original was removed, and whatever is left over in the changed text was added. The tool uses the algorithm Eugene Myers published in 1986, An O(ND) Difference Algorithm and Its Variations, which is fast when the texts are similar. It is also the default algorithm of git diff.
Before that, lines that appear exactly once in both texts are matched first, the idea behind patience diff, which git also offers as an option. It keeps a moved function or paragraph from pulling unrelated lines out of place. For words and characters, tiny accidental matches between two changes, like a shared space, are merged into the change, so "The cat sat" against "A dog ran" reads as whole phrases replaced instead of a jumble of single letters.
Copy or download the differences
Copy result gives you the differences as text. In line mode that is a unified diff, the format of diff -u, with lines starting with a minus for removed, a plus for added and a space for context, which you can paste into an email, a ticket or a code review. In word and character mode you get the text with changes marked as [-removed-] and {+added+}, the plain style of git’s word diff. Download saves the same result as a file.
Tips
- Paste the older version on the left. Swap fixes it if you got them the wrong way around.
- To compare two lists regardless of order, sort and clean both first with remove duplicate lines, then compare the results.
- Found a mistake that repeats? Fix it everywhere at once with find and replace.
How to use the text compare tool
- 1Paste the original text on the left and the changed text on the right, or open a file for each.
- 2Choose Lines, Words or Characters, and turn on the ignore options you need.
- 3Read the counts, step through the differences with Prev and Next, then copy or download the result.
Frequently asked questions
How do I compare two texts for differences?
Paste the older version into Original text and the newer one into Changed text. The differences appear right away: removed text in red, added text in green, and lines that were edited are paired so you see exactly which words changed. Pick Lines, Words or Characters to set how fine the comparison is.
What is the difference between comparing by lines, words and characters?
Lines is best for code, lists, data and anything with one item per line; a line that changed shows the changed words inside it. Words is best for prose such as essays, emails and contracts, because a reflowed paragraph does not show as a wall of changes. Characters finds the smallest edits, like a missing comma, a swapped letter or a wrong digit in an ID.
What does "changed" mean in the counts?
When text was removed and new text was added in the same spot, the pair counts as changed instead of as one removal plus one addition. In line mode a removed and an added line are paired when they share enough of their words; completely different lines count as removed and added.
Can it compare very large texts?
Yes. The comparison runs in a background thread of your browser, so the page stays responsive, and texts of 10,000 lines and more work. Long stretches of unchanged lines are folded away; click a fold to see those lines. If two big texts have almost nothing in common, some blocks are shown as removed and added as a whole instead of word by word, which keeps the tool fast.
Can I compare two files?
Yes. Use Open file above each box, or drag a text file onto a box. Plain text, Markdown, CSV, JSON, HTML, code and log files work. The file is read in your browser and never uploaded. Word documents and PDFs need to be copied as text first.
Is my text uploaded or saved?
No. Both texts stay in your browser and are compared on your device. Copy link only shares your settings, such as the mode and the ignore options, never the texts.