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

Title Case vs Sentence CaseLearn the difference between title case and sentence case, plus when to use uppercase, lowercase, camelCase, snake_case and kebab-case.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.Open Graph Meta TagsLearn which Open Graph and Twitter Card meta tags control link previews on Facebook, LinkedIn, WhatsApp, X, Slack, and other sharing surfaces.HTML Entities and EscapingLearn when to escape HTML, which characters need entities, how encoding helps prevent XSS, and when decoding HTML entities is safe.