DevKit
Tester

Word-Level Diff

Compare texts and highlight differences at the word level.

Last updated: August 2026

Share:

Was this tool helpful?

Diffing at the word level

A word-level diff compares two texts and marks exactly which words were added, removed, or changed. Line-based diffs flag a whole line as changed even if a single word moved, which buries the real edit. Word-level granularity is far easier to read for prose, where a sentence rarely changes entirely.

When to pick it

It shines on edited paragraphs, translated copy, revised documentation, and anywhere a human rewrote text rather than restructured a file. For source code, line diffs usually read better because code changes tend to be line-shaped. For reconciling two edits against an original, reach for a 3-way diff instead.

Example

Old: the quick brown fox jumps
New: the slow brown fox leaps

the [-quick-]{+slow+} brown fox [-jumps-]{+leaps+}

The unchanged words anchor the comparison, while the bracketed segments show one word swapped and one changed. Shared context is what makes the edit legible.

How the matching works

Under the hood a diff finds the longest common subsequence of tokens, then treats the gaps as insertions and deletions. Tokenizing on word boundaries, including or excluding punctuation, changes the result. If punctuation is its own token, changing end. to end! shows just the mark changing rather than the whole word.

FAQ

Why is a moved paragraph shown as delete plus add? Standard diffs do not detect moves; relocated text reads as removed in one place and inserted in another.

Does it ignore whitespace changes? That is usually an option. Collapsing whitespace first avoids noise from reflowed lines.

Is case treated as a difference? By default yes, The and the differ unless you enable case-insensitive comparison.