How to Compare Two Texts Online (and Actually Read the Diff)

·6 min read

"Which version has the typo?" is a question you shouldn't have to answer with your eyeballs. A good diff tool tells you in a glance. This post covers when to use line vs word vs character diff, how to prepare messy inputs so the diff is actually useful, and a couple of tricks that make the result far more readable.

The three diff modes

Line diff is the default in Git and every code review tool. It compares whole lines and highlights any line that isn't byte-identical. Best for: source code, formatted JSON, YAML, logs.

Word diff compares word-by-word inside changed lines. Best for: articles, contracts, translations — anywhere a single word swap matters more than the line it lives on.

Character diff goes down to individual characters. Best for: hunting a typo, comparing very short strings (variable names, IDs), or diffing text without spaces (URLs, hashes).

Preparing inputs so the diff isn't noise

The single biggest cause of unreadable diffs is trivial formatting differences. Before you compare:

  • Normalize whitespace and line endings. A CRLF vs LF mismatch or a stray tab-vs-space rewrites every line.
  • Format structured data first. Two functionally identical JSON documents will diff as 100% different if one is minified. Run both through a formatter first.
  • Strip volatile fields. Timestamps, request IDs, generated hashes — remove them or replace them with a placeholder before diffing snapshot outputs.

Reading the highlights

Every diff tool uses the same visual grammar:

  • Green — content added in the new version.
  • Red — content removed from the original.
  • Yellow / mixed — a line that changed. Word or character mode expands this into the exact edits.

Focus on the modified segments; the unchanged regions are context, not content.

The algorithm, in one paragraph

Modern diffs use the longest common subsequence (LCS) — they find the biggest set of lines (or words, or characters) that appear in the same order in both sides, then flag everything else as an add or remove. That's why moving a block often shows up as a large delete on one side and a large insert on the other, rather than a "move". It's mathematically correct, even when it doesn't match your intuition.

Real use cases

  • Contract review: word diff between the counterparty's redline and your last version — every changed clause pops.
  • Code review off-Git: line diff between two versions of a config file a colleague pasted into Slack.
  • Translation QA: character diff between the machine translation and the human edit to see exactly what the editor changed.
  • API response drift: line diff between yesterday's cached response and today's, after formatting both.

Try it now

Paste two versions of anything into our Text Diff Checker. Switch between line, word and character modes to find the level of detail that makes the change obvious. Everything stays in your browser — no upload, no signup.

Keep reading