How to Compare Two Texts and Find the Differences

Updated 2026-08-31 · 3 min read

What a diff actually computes

A diff tool does not compare characters position by position — that would flag everything after a single inserted line. It searches for the longest common subsequence between the two inputs, then reports whatever is left over as insertions and deletions. That is why adding one line at the top of a file yields one added line, not a wholly changed file.

Line diff vs word diff

Pick the granularity that matches the content:

Practical example: catching config drift

Staging works, production returns 500. You paste both environment files side by side and the diff shows a single changed line:

Noise that hides real changes

Most 'everything changed' diffs come from formatting, not content. Before comparing, normalise the obvious offenders: trailing whitespace, tabs versus spaces, Windows CRLF versus Unix LF line endings, and reformatted JSON with different indentation. For JSON specifically, run both sides through a formatter first so keys and indentation are consistent — then the remaining diff is genuine.

Where a browser diff beats git

git diff only helps for tracked files in one repository. A browser diff handles the cases around it: two API responses, an email draft before and after edits, a vendor's sample config against yours, a client's revised copy, or two rows pasted out of a database. There is nothing to commit and nothing to install.

Reading a diff without misjudging it

Check the change count before the colours: a large number of changed lines with a small number of changed words usually means a reformat, not a rewrite. And confirm which side is which — reversing old and new turns every deletion into an addition and makes an innocent cleanup look like data loss.

Compare your texts now

Paste both versions into the Diff Checker to see additions and deletions highlighted in your browser. For JSON, normalise both sides with the JSON Formatter first, and use the Hash Generator when you only need to know whether two large files differ.

Try the Diff Checker →Compare two texts or code snippets online and see added, removed and changed lines highlighted. Free diff checker, private and browser-based.

Frequently asked questions

Is my text uploaded when I compare it online?

In ToolZone's Diff Checker, no — the comparison runs in your browser, so pasted contracts or config never leave the device.

Can I diff two PDFs or Word files?

Not directly; copy the text out first. Binary formats need a converter before any text diff is meaningful.

Why does the diff show every line as changed?

Almost always mismatched line endings or indentation. Normalise whitespace and re-run.

More guides

How Many Words Is a 5-Minute Speech?A 5-minute speech is roughly 625–750 words at a normal speaking pace. See word counts for 1, 3, 5, 10 and 20-minute talks, plus how to check yours instantly.How to Validate JSON and Fix Common Syntax ErrorsLearn how to validate JSON and fix the most common errors: trailing commas, single quotes, unquoted keys, comments and unescaped characters — with examples.Base64 Is Not Encryption: What It Actually DoesBase64 is reversible encoding, not encryption. Learn what Base64 is for, when to use it, its 33% size cost, and safe alternatives for protecting data.How to Decode a JWT SafelyLearn what is inside a JSON Web Token, how to decode the header and payload, how to read exp and iat claims, and why decoding is not verification.