How to Compare Two Texts and Find the Differences
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:
- Line diff — best for code, CSV, logs and config, where a line is a meaningful unit.
- Word diff — best for prose, translations and legal text, where one sentence gets reworded.
- Character diff — best for short strings such as an API key, hash or URL where a single character matters.
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:
- CACHE_TTL=300+ CACHE_TTL=30O— the last character is a letter O, not a zero.- A visual scan misses that. A character-level diff highlights it instantly.
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.