Diff Checker / Text Compare
Compare two blocks of text and highlight additions and deletions, line-by-line or word-by-word.
What This Tool Does
This tool compares two blocks of text and highlights exactly what changed — additions in green, deletions in red — so you can spot the actual differences between two versions of code, a document, or a configuration file instead of re-reading both in full to find them yourself.
How to Use It
Paste the original version on the left and the changed version on the right, choose Line-level or Word-level comparison, and click Compare. The result shows the merged text with additions highlighted in green and deletions struck through in red.
The Formula
This tool uses diff (jsdiff), a well-established, widely used diffing library — the same kind of library underlying diff tooling in major editors and build tools — rather than a hand-rolled diff algorithm. A correct diff algorithm (this library implements the classic Myers diff algorithm) has real, easy-to-get-wrong edge cases; reusing a mature, thoroughly tested library was the deliberate choice here instead of reimplementing that logic from scratch for a single tool.
A Worked Example
Comparing line one / line two / line three against line one / line TWO / line three / line four in Line-level mode shows line one and line three as unchanged, line two struck through as removed, line TWO highlighted as added in its place, and line fourhighlighted as a new addition at the end. In Word-level mode, comparing "the quick brown fox" against "the slow brown fox" shows only quick as removed and slow as added — the surrounding words stay untouched, since only the single differing word is flagged.
Line-Level vs. Word-Level: When to Use Each
Line-level comparison treats each full line as a unit, which is exactly what you want for code changes, configuration files, or structured data — a single changed character inside a long line still shows the whole line as changed, which is the right granularity for reviewing a code diff, a JSON config edit, or a CSV row.
Word-level comparisoninstead isolates individual changed words within otherwise-identical surrounding text, which is far more useful for prose — comparing two revisions of an article, a contract, or an email draft where whole paragraphs are largely the same and only a handful of words actually changed. Line-level mode on the same prose comparison would show entire paragraphs as "changed" the moment a single word differs, obscuring how small the actual edit was.
FAQ
- What's the difference between line-level and word-level comparison?
- Line-level treats each full line as a unit — best for code and config files. Word-level isolates individual changed words within otherwise-identical text — best for comparing prose revisions.
- Does this use a real diff algorithm?
- Yes — it uses the well-established diff (jsdiff) library, which implements the standard Myers diff algorithm, rather than a hand-rolled implementation.
- Is my text sent to a server?
- No, all comparison happens directly in your browser. Your text never leaves your device.