Text & wordsFree
Free text diff checker. Compare two texts line-by-line or word-by-word and highlight additions and deletions in your browser.
Last updated 14 October 2026
The comparison works by finding the longest sequence of tokens the two texts have in common and marking everything else as added or removed. What a token is depends on the mode: in line mode a token is a whole line, in word mode it is a word or a run of whitespace. Nothing smaller is ever compared.
That choice has more consequences than it first appears, including a size limit that is much tighter in one mode than the other. Both are measured below.
Measured, changing “cat” to “bat” in the first of two lines:
Neither is wrong; they answer different questions. Line mode is the right tool for code, configuration and anything where the line is the unit you care about, and it is what version control shows you. Word mode is the right tool for prose, where a line is an accident of wrapping.
There is no character-level mode, so a changed word is always shown whole. If you need to see which letter moved, word mode narrows it to one word and then you are on your own.
The comparison builds a table with one cell for every pair of tokens, and the page refuses when that table would exceed 2.5 million cells. Measured by feeding it progressively larger inputs until it refused:
Word mode runs out sooner because the whitespace between words is itself a token, so a text of 791 words is about 1,581 tokens. Seven hundred and ninety words is roughly a page and a half of prose, which is less than many of the documents people would want to compare.
When it refuses, the message reads “Texts too large for in-browser diff. Shorten and retry” and no comparison is shown. The limit exists to stop the page freezing, since the work grows with the product of the two lengths rather than their sum. Compare a section at a time, or switch to line mode, which gets you roughly twice as far.
A moved block is a deletion and an addition. Measured, reordering three lines from alpha, bravo, charlie to charlie, alpha, bravo reports Unchanged 2, Added 1, Removed 1, with “charlie” appearing twice in the output, once as added at the top and once as removed at the bottom. Nothing says the text merely moved. Reordering a document therefore looks like heavy editing.
Whitespace counts. In word mode, changing a b to a b, with one extra space, is reported as a change, because the run of whitespace is a token in its own right. In line mode the same edit marks the whole line replaced. There is no option to ignore whitespace.
A trailing newline is a difference. Measured, comparing a with a followed by a newline reports Added 1, because splitting on newlines leaves an empty final token. The two texts look identical on screen and the tool is right that they are not. This is the most common cause of a difference nobody can see.
Case is also significant: Hello against hello is a complete replacement, with no option to ignore it.
The summary line counts tokens, not lines or words in the ordinary sense, and the number changes with the mode even though the texts have not. The same one-letter edit gave Unchanged 1 in line mode and Unchanged 10 in word mode, because in word mode it is counting words and the spaces between them.
Where a line is replaced, the removal is always listed before the addition. That is a deterministic choice in the comparison rather than an inference about what you did, so a replacement always reads old-then-new.
Identical texts report everything unchanged and nothing added or removed, which is the quickest way to confirm two things really are the same. Swapping the two sides exchanges the additions and the removals and nothing else.
If the difference you are chasing is invisible, Text Cleaner will show you what whitespace and stray characters are actually present before you compare.
String.prototype.split. developer.mozilla.orgEvery behaviour and every value on this page was measured against this tool as it is published, in a browser, on 14 October 2026.
Because in line mode the unit of comparison is the line, so any change at all replaces it. Switch to word mode and the same edit is narrowed to a single word: measured, a one-letter change reported Unchanged 1, Added 1, Removed 1 in line mode and Unchanged 10, Added 1, Removed 1 in word mode.
Line mode for code, configuration and anything where the line is meaningful, which is also what version control shows. Word mode for prose, where line breaks are an accident of wrapping. Word mode also hits its size limit twice as fast.
Measured, line mode accepts up to 1,581 lines a side and refuses at 1,582; word mode accepts up to 791 words a side and refuses at 792. Word mode runs out sooner because the spaces between words are tokens too. Compare one section at a time, or use line mode.
That is expected. There is no move detection, so reordering shows as a removal in one place and an addition in another, with the same text appearing twice in the output. Reordering a document will always look like a large edit here.
Check for a trailing newline. Measured, a against a followed by a newline reports one addition, because the newline leaves an empty token at the end. Extra spaces and a change of case will do the same thing, and none of the three is visible on screen.
No. There are no options at all beyond the two modes. Whitespace runs are compared as tokens in word mode, and Hello against hello is a full replacement.
They count tokens, not lines or words as you would normally count them, and the unit changes with the mode. The same edit can report Unchanged 1 in line mode and Unchanged 10 in word mode, because word mode is counting words and the spaces between them.
No. Both texts stay in your browser and the comparison runs there, which is the main reason to use this rather than an online diff service for a contract, a configuration file or anything else you would not paste into a stranger's server.