Diff Checker (Text Compare)

Runs locally

Compare two blocks of text line-by-line or word-by-word.

Original

Modified

+2-2

Result

-function greet(name) {
- console.log("Hello " + name);
+function greet(name, punctuation = "!") {
+ console.log(`Hello, ${name}${punctuation}`);
}
Guide

When a diff lies to you

A line diff finds the longest common subsequence of lines and calls everything else an addition or a deletion. That model is exactly right for source code and exactly wrong for several common situations, and knowing which is which saves a lot of time staring at a wall of red. For JSON, sort the keys of both documents first so only real changes show.

Word-level comparison helps for prose and for single-line changes; it does not help when the underlying problem is that the two files differ in ways you cannot see. For config files, compare .properties by key instead of by line.

Symptom

Every single line shows as changed

A formatter ran and the real change
is invisible

A block moved 200 lines down

Two names look identical but differ

Usual cause

Line endings (CRLF vs LF) or trailing
whitespace — not content

Diff the parsed structure instead:
sort the JSON keys, then compare

LCS has no concept of a move; it is
a delete plus an insert

Unicode: e + combining accent versus
the single precomposed character

Where people get caught

Line endings make everything look changed

A file saved on Windows and a file saved on macOS differ on every line by one invisible byte. If the whole file lights up after someone else edits it, check CRLF before you read a single line of the diff.

Reformatting hides real changes

Run a formatter and a one-character logic change is buried in 400 reflowed lines. For JSON and YAML, normalise first — sort the keys, then diff — so the comparison is about content rather than layout.

Moves are invisible to the algorithm

LCS produces a deletion here and an insertion there. A refactor that reorders functions therefore reads as a rewrite, which is why reviewers ask for moves and edits in separate commits.

Word diff is right for prose, wrong for code

Word-level highlighting is much easier to read in a paragraph. In code it fragments — a renamed variable lights up every occurrence in the middle of lines and you lose the shape of the change.

Equal-looking text can differ in bytes

Non-breaking spaces pasted from a document, smart quotes from a word processor, and two Unicode spellings of an accented character all render identically and compare as different. If a diff insists two identical lines differ, that is why.

Whitespace-only noise buries the signal

Indentation changes, tabs converted to spaces and stripped trailing whitespace can account for most of a diff. Compare with whitespace ignored first to see whether anything real happened, then look properly.

About the diff checker

How it works in 4 steps · 4 common use cases · 3 questions answered

How it works

  1. 1.Paste the original on the left and the changed version on the right.
  2. 2.Pick line mode for code and structured data, or word mode to catch small edits inside prose.
  3. 3.Additions and deletions are highlighted inline, with a count of what changed.
  4. 4.Turn on the whitespace option to ignore indentation-only differences.

Common use cases

  • •Comparing two API responses to find the one field that changed
  • •Checking what differs between a staging and a production config file
  • •Reviewing an edit to a block of text before pasting it back
  • •Spotting an accidental change in a generated file

FAQ

When should I use word mode instead of line mode?

Line mode is right for code, JSON and anything where a line is a meaningful unit. Word mode is better for paragraphs, where a one-word change would otherwise mark the entire line as rewritten.

Can I diff two JSON documents whose keys are in a different order?

Sort both with the JSON Sort Keys tool first. Once the key order matches, the remaining differences in the diff are the real ones.

Is there a size limit?

No hard limit, but diffing runs in your tab, so two very large files will be slower here than a native diff tool.