Word-Level Text Diff Tool
Compare two texts word by word with color-coded additions, deletions, and changes side by side.
このツールについて
The Word-Level Text Diff Tool compares two blocks of text at the word level and highlights exactly what changed between them. Unlike line-level diff tools, this tool operates word by word, making it easy to spot small edits, substitutions, or rewordings inside a paragraph. Paste the original text on the left and the revised text on the right, then view a merged diff panel that color-codes every change: green for added words, red for removed words, and orange for words that changed in place. A statistics bar shows total words added, removed, and changed at a glance. The side-by-side layout makes it ideal for proofreading drafts, reviewing document revisions, or comparing API responses. No server upload — all processing happens locally in your browser.
使い方
- 1 Paste the original text into the left textarea.
- 2 Paste the revised text into the right textarea.
- 3 The diff updates automatically as you type.
- 4 Read the color-coded merged view: green = added, red = removed, orange = changed.
- 5 Check the stats bar for a count of words added, removed, and changed.
What "diffing" two texts really means
When you compare two versions of a paragraph, your eye wants to know three things: which words were added, which were removed, and which were swapped for something else. A diff tool answers that mechanically. The hard part is alignment — given the original and the revised text, the tool has to figure out which words stayed put so it can highlight only what genuinely moved. This tool works at the word level rather than the character or line level, which is what makes its output readable for prose: it highlights "quick red fox" rather than flagging every changed letter or marking an entire line as different because one word shifted.
The algorithm: longest common subsequence
Under the hood the tool tokenizes each text into words, then finds the longest common subsequence (LCS) — the longest ordered list of words that appears in both texts without necessarily being contiguous. The classic example: between "The quick brown fox" and "The quick red fox," the LCS is "The quick fox." Everything in that subsequence is unchanged; everything else is an edit. The tool computes the LCS with a dynamic-programming table, walks backward through it to recover the matching words, then classifies the gaps between matches: words present only in the original are removals, words present only in the revision are additions, and where a removal sits directly next to an addition the tool merges them into a single change.
A worked example
Put this in the original box: The quick brown fox jumps over the lazy dog.
And this in the revised box: The quick red fox leaps over the sleepy cat.
The tool aligns the shared backbone — "The quick … fox … over the … " — and reports the rest as edits. "brown" becomes "red" and "jumps" becomes "leaps": both are detected as changes (a removal immediately followed by an addition), shown with the old word struck through in red and the new word in orange. "lazy dog" turning into "sleepy cat" is likewise flagged. The stats bar tallies these into added, removed, and changed counts, plus the total word count of the revised text so you can gauge how heavy the edit was.
The three colors, and why "changed" exists
| Color | Meaning |
|---|---|
| Green | A word that appears only in the revised text — an addition |
| Red (struck through) | A word that appears only in the original — a removal |
| Orange | A substitution: a removal and an addition that sit side by side |
Plenty of diff tools only know "added" and "removed," which forces a one-word edit to show as a red word and a green word with no visual link between them. By merging adjacent delete-then-insert pairs into a single orange "changed" marker, this tool reflects how a human actually reads a revision: as one thing replacing another.
Genuine use cases
- Reviewing edits to your own writing. Paste a draft and an editor's returned version to see exactly what they touched without re-reading the whole thing.
- Comparing terms of service or contract versions. Word-level highlighting surfaces the clause that quietly changed between two revisions.
- Checking AI or translation rewrites. See at a glance how much of your text a rewrite tool actually altered versus left alone.
- Catching copy-paste drift. Two snippets that "look the same" often differ by a word or two; the diff makes the difference impossible to miss.
Common mistakes and limits
- Expecting character-level precision. Because comparison is per word, changing "color" to "colour" registers as a whole-word change, not a single inserted letter. That is by design — it keeps prose diffs legible.
- Reading "change" as a guaranteed semantic pair. The orange marker is purely positional: a removal next to an addition. It does not claim the two words mean the same thing, only that they occupy the same spot.
- Diffing identical texts. If the two boxes match exactly, the tool tells you so rather than showing an empty result — a quick way to confirm two passages are truly the same.
- Very large inputs. The LCS table grows with the product of the two word counts, so comparing two book-length documents will be slow; this tool is built for paragraphs and pages, not whole manuscripts.
Privacy
Both texts are compared entirely in your browser — the LCS computation is plain JavaScript running on your device. Nothing you paste is sent anywhere or stored, so it is safe to diff confidential drafts, and the tool keeps working with no internet connection.