How to use
- Paste the original version on the left and the changed version on the right.
- Choose Line diff (default) or Word diff for the whole document.
- Pick a language to highlight code, or leave it on Auto-detect.
- Added lines/words are green, removed are red; a changed line also shows exactly which words changed.
- Read it Side by side (old and new aligned, each with its own line numbers) or Unified, and step through the changes with the ↑ ↓ buttons.
Two ways to compare, because "changed" means different things
A config file or source code has meaningful line structure: which line something is on is part of what changed. Prose usually does not: a paragraph can be rewrapped at a different width with zero real edits. Line diff serves the first case, and inline-highlights the exact word inside a changed line rather than just marking the whole line different. Word diff serves the second case by ignoring line breaks altogether.
Example
Line diff on a single changed word:
- The quick brown fox jumps.
+ The quick red fox jumps.
Second line.Word diff correctly ignoring a rewrapped paragraph with no real edits (0 words changed):
The quick brown
fox jumps over
the lazy dog.
->
The quick brown fox
jumps over the
lazy dog.Options explained
- Line diff / Word diff: see the FAQ for when to use each.
- Language: Auto-detect guesses from simple patterns (brackets and colons for JSON, angle brackets for HTML,
SELECT/FROMfor SQL, and so on); pick one directly if it guesses wrong, or Plain text to turn highlighting off entirely. - Paste (one per box, beside its character count) fills that box from your clipboard. Swap sides exchanges Original and Changed, and Clear both empties both boxes.
- Side by side / Unified: side by side puts each original line next to the line that replaced it, with a hatched gap where a line exists on one side only; unified lists each change as its removed lines followed by its added lines. Your choice is remembered in this browser. Phones always get Unified, since two columns of code do not fit.
- ↑ ↓ and Show all lines: the arrows jump between changes and mark the current one. Long unchanged stretches are folded to three lines of context either side of a change; click a fold to open it, or tick Show all lines.
Edge cases and common errors
- Identical inputs show "No differences found." rather than an empty, ambiguous result.
- A block of lines replaced by a different block is paired line by line in order. A pair gets word-level highlighting only when at least half of its text is shared; two unrelated lines that merely sit side by side are marked as a whole removed line and a whole added line instead, since highlighting every word of them says nothing useful. Leftover lines on the longer side show as plain removals or additions.
- Very large inputs are refused past 5,000 lines or 20,000 words per side, with the specific limit named in the error, rather than freezing the page.
- Syntax highlighting only applies to line diff, and is skipped on a line with an inline word-level change in favor of the word-diff colors on that line.
Do the same thing in code
# Python: a quick line diff using the standard library
import difflib
diff = difflib.unified_diff(a.splitlines(), b.splitlines())
print('\n'.join(diff))Comparing two JSON documents instead of plain text? A line diff will flag a reordered key as a change even though nothing meaningful is different; the JSON Diff Checkercompares by key path instead, so that never happens.