Skip to content

Diff Checker Online: Compare Text and Spot Every Real Change

Free online diff checker — line and word-level highlighting, whitespace/case-insensitive options, and a unified diff you can save as a patch.

Try it now: Text Diff Checker Compare two blocks of text with line and word-level highlighting, whitespace and case options, and a unified diff you can save as a patch.

Line-Level vs. Word-Level Diffing

A diff checker online compares two blocks of text and reports what changed between them, but “what changed” means something different depending on the granularity it works at. A pure line-level diff treats each line as a single unit — if any character on that line differs, the whole line is marked changed, full stop. That's fine when lines are short, but on a long line — a wrapped sentence of prose, a config line with a dozen key-value pairs, a minified line of code — marking the entire line red and green tells you something changed without telling you what. You still have to eyeball the whole line to find the one word that's actually different.

Word-level highlighting fixes that by diffing within the line as well as across lines: it shows you the line pair as mostly unchanged and highlights only the specific words that differ inside it. For text compare on prose, config files, or any content with long lines, that's the difference between scanning a wall of red-and-green and reading the actual edit at a glance.

line-level vs. word-level diff of the same edit
Original: The deployment script now retries failed uploads three times before giving up.
Changed:  The deployment script now retries failed uploads five times before giving up.

Line-level diff:
- The deployment script now retries failed uploads three times before giving up.
+ The deployment script now retries failed uploads five times before giving up.

Word-level diff (same two lines):
The deployment script now retries failed uploads [three→five] times before giving up.

Both views describe the same edit. The line-level version is correct but makes you reread the entire sentence to locate the change; the word-level version puts the change under a highlight and leaves everything else visually quiet. Longer lines make the gap between the two more pronounced, not less.

Whitespace-Insensitive and Case-Insensitive Comparison

Two options turn out to matter in practice more than their names suggest. The first is whitespace sensitivity. If you're comparing two versions of a document and only the indentation or line endings changed — a file re-saved with a different editor, or re-indented by a formatter, with no real content touched — a whitespace-sensitive diff will report every single line as changed, which is noise. Turning on whitespace-insensitive comparison collapses those non-differences and leaves only the lines whose actual content moved.

The second is case sensitivity. Sometimes two strings need to be checked for equivalence in a context that itself doesn't care about case — a hostname, a header name, an identifier some downstream system treats case-insensitively. API-Key and api-keyare the same header as far as HTTP is concerned, but a case-sensitive text diff will flag every occurrence as a change. A case-insensitive comparison mode answers the actual question being asked — “are these equivalent for how this system treats them?” — instead of the more literal one.

  • Whitespace-insensitive: use it when comparing formatting-only changes to skip past re-indentation and line-ending noise and get straight to real content edits.
  • Case-insensitive:use it when the strings you're comparing come from a case-insensitive context — hostnames, some identifiers, config keys some tools normalize.

Practical Use Cases

  • Reviewing a rewritten paragraph. Word-level highlighting on a text diff online makes it obvious which phrases actually changed in a rewrite, rather than forcing a full reread of both versions.
  • Comparing two files pasted from different sources. When you need to compare two files — two config exports, two versions of a script pulled from different environments — a diff checker finds every real discrepancy without you scanning line by line manually.
  • Verifying a find-and-replace across a document.Diffing before and after confirms the replacement touched only the lines it was supposed to and didn't alter anything unrelated.
  • Producing a patch to hand off.Once you've confirmed the changes are correct, a unified diff export gives you a file that documents exactly what changed and can be applied elsewhere.

The Unified Diff Format, and Why It's the Useful Export

A diff you can only look at is useful for review; a diff in the unified diff format is useful for both review and tooling. Unified diff is the format git diff produces by default and the format the standard patchcommand consumes — so a unified diff exported from a browser-based tool isn't just a readable report, it's a file that ordinary command-line tooling can apply directly to a matching source file.

The format has three parts. The --- and +++ lines are file headers, naming the original and the changed version. Each block of changes is preceded by a hunk header shaped @@ -oldStart,oldLines +newStart,newLines @@, which records where in each file the hunk starts and how many lines it spans. Inside the hunk, unchanged lines are shown for context with a leading space, removed lines are prefixed with -, and added lines are prefixed with +.

unified diff — retries.txt
--- a/retries.txt
+++ b/retries.txt
@@ -1,3 +1,3 @@
 The deployment script now retries failed uploads
-three times before giving up.
+five times before giving up.
 It logs each attempt to the console.

Read this hunk exactly as patch would: it starts at line 1 in both files, spans 3 lines on each side (-1,3 +1,3), keeps the first and last lines unchanged, removes the old “three times” line, and inserts “five times” in its place. Because this is the same format Git and patchalready understand, exporting it from a browser tool isn't a proprietary shortcut — it's a plain-text artifact you can commit, email, or apply with git apply or patch -p1 without ever opening the tool again.

GenKitLab's Diff Checker compares two blocks of text with line- and word-level highlighting, whitespace and case options, and a unified diff you can save as a patch — and it runs entirely client-side, so nothing you paste is uploaded anywhere. If the two things you're comparing are JSON documents rather than arbitrary text, a text-level diff is the wrong tool for the job: two JSON objects with the same keys in a different order are semantically identical but would show as a full-line diff everywhere. For that case, JSON Diff compares two documents structurally, ignoring key order, and is covered in full in the JSON Diff guide.

Frequently asked questions

What's the difference between a line-level and word-level diff?

A line-level diff marks an entire line as changed if any part of it differs, even when only one word actually changed. Word-level highlighting diffs within the line too, so it highlights just the specific words that differ and leaves the rest of the line unmarked — which matters most on long lines of prose, config, or code.

When should I use whitespace-insensitive comparison?

Use it when comparing two versions of a document where you suspect only formatting changed — re-indentation, different line endings, trailing spaces — and you want to skip past that noise to see whether any real content differs.

When does case-insensitive comparison matter?

When the two strings you're comparing come from a context that itself doesn't distinguish case — a hostname, an HTTP header name, or an identifier some system normalizes — so 'API-Key' and 'api-key' should be treated as equivalent rather than flagged as a change.

What is a unified diff, and why export in that format?

Unified diff is the format git diff produces and the standard patch command consumes: --- / +++ file headers, an @@ -oldStart,oldLines +newStart,newLines @@ hunk header, and -/+ prefixed changed lines. Exporting a comparison in this format means it can be applied elsewhere with ordinary command-line tools, not just read visually.

Is a text diff checker the same as a JSON diff tool?

No. A text diff compares two blocks of text line by line (and word by word within a line) with no understanding of structure — two JSON objects with reordered keys would show as fully changed. A JSON diff tool parses both documents and compares them structurally, so key reordering doesn't register as a change.

Is anything I paste into an online diff checker uploaded anywhere?

Not in GenKitLab's Diff Checker — the comparison runs entirely in your browser using client-side JavaScript. Nothing you paste is sent to a server.

Last updated