A diff checker computes the minimum set of edits that transforms one text into another and visualizes those edits as additions, removals, and unchanged passages. The classic algorithm is Eugene Myers' 1986 O(ND) longest-common-subsequence diff - the same algorithm GNU diff, git diff, and most code-review tools use under the hood.
This tool uses jsdiff (the "diff" npm package by Kevin Decker), the canonical JavaScript implementation of the Myers algorithm. It powers the diffs you see in CodeSandbox, the Algolia search comparison views, GitLens for VS Code, and countless other tools. It's mature, battle-tested, and ships at around 30 KB minified - small enough to run entirely in your browser without a network round-trip.
Two granularity modes are exposed. diffLines, the default, treats each line as a token and reports line-level adds and removes - the right view for code review, configuration changes, and any text where line breaks carry semantic meaning. diffWords splits at word boundaries (with whitespace as separators) and is better for prose, comparing two drafts of a paragraph, or spotting a single inserted word inside a long line. The tradeoff is speed: word-level diff has to compare many more tokens, so on multi-thousand-line inputs you'll feel the slowdown.
Display switches between unified and split views. Unified is the GitHub / git diff style: one column with + and - markers in the gutter, additions in green, removals in red. Split shows old on the left and new on the right - the style of FileMerge, Beyond Compare, and most desktop merge tools. Unified is denser and better for reading; split is better for resolving conflicts because your eye can match lines horizontally.
Auto-compare runs on a 400 ms debounce after each keystroke once both panels have content. The debounce matters because diffLines on a 1,000-line file takes 5-15 ms but doing it on every keystroke would still feel laggy. The debounce time is short enough to feel instantaneous and long enough to skip wasted work mid-typing.
The patch download produces a simplified diff format with + / - / space prefixes per line, suitable for human reading. It is not a true unified diff with hunks - it's missing the @@ -line,count +line,count @@ headers that git apply needs. If you want a real applicable patch, use git diff or jsdiff's Diff.createPatch / createTwoFilesPatch functions. The download is good for archive and review purposes.
Performance limits to know. Myers diff is O((N+M)*D) where D is the number of differences - it's fast when the two texts are mostly the same and degrades when they're mostly different. Comparing two completely unrelated 5,000-line files can take a couple of seconds. For very large inputs (10 MB+) consider line-level only, or pre-process to align unchanged headers so D stays small.