Diff Checker — Compare Two Texts
Find differences between two text files. Additions, deletions, and modified words are highlighted side by side — nothing leaves your browser.
What is a diff checker?
A diff checker lines up two versions of a text and marks what changed between them. This one works line by line first, then word by word inside lines that were edited, and shows the result side by side: Text 1 on the left, Text 2 on the right. It suits source code, configuration files, SQL, CSV, logs and prose — anything you can paste as plain text.
How to compare two texts
- Paste the original into Text 1 and the new version into Text 2. There is no file upload, so open files in an editor and copy their contents.
- Tick any of the four options below if you want differences in case, order, wrapping or spacing ignored.
- Click Compare, or press Ctrl+Enter (⌘+Enter on a Mac).
- Read the summary next to the buttons, for example
+1 added −0 removed ~1 modified, or “The two texts are identical.” - Click Edit texts to return to the editors, Switch texts to swap the sides (the comparison reruns if it is showing) or Clear all to start again.
Reading the result
- A line only in Text 1 is shaded red on the left with a blank cell opposite; a line only in Text 2 is shaded green on the right.
- A modified line appears on both sides with only the changed words highlighted. Lines are paired this way when at least 30% of their words match; otherwise they appear as one removal and one addition.
- Words are runs of characters between spaces, so punctuation belongs to its word:
world.versusworldhighlights the whole word.
Comparison options explained
Options change the texts before comparing, and the result shows the changed texts. They take effect when you click Compare.
- To lowercase — makes case irrelevant:
Helloandhellomatch. - Sort lines — sorts each side’s lines before comparing, for lists where order does not matter, such as dependencies, allow-lists or exported IDs. Sorting is by character code, so capitals come before lower case (
Applesorts beforebanana,Bananabeforeapple); tick To lowercase as well for a case-blind sort. - Replace line breaks with spaces — joins each text into one line, so paragraphs wrapped at different widths compare equal. Blank lines disappear too.
- Remove excess white space — turns runs of spaces and tabs into one space and strips spaces at the start and end of every line. Indentation, tabs versus spaces and trailing spaces are then ignored.
Line endings are always normalised: Windows (CRLF), old Mac (CR) and Unix (LF) line breaks are treated as the same.
Common problems and fixes
| Symptom | Cause | Fix |
|---|---|---|
| A line is counted as modified but no word is highlighted | The lines differ only in white space, such as trailing spaces or a tab instead of spaces. White space is compared but hard to see. | Tick Remove excess white space if spacing does not matter. |
| One empty line is reported as added at the end | One text ends with a line break and the other does not. | Ignore it, or remove the final newline from one side. |
| Every line differs in two JSON or SQL files | One side is minified or formatted differently. | Format both sides the same way first with the JSON Formatter or SQL Formatter. |
| JSON objects with the same keys show as different | The keys are in a different order; a text diff compares characters, not meaning. | Format both with the JSON Formatter’s Sort keys (A-Z) option, then compare. |
| A block that moved shows as removed and added | The diff finds the longest common sequence of lines in order; it does not detect moves. | Expected behaviour. Tick Sort lines if order genuinely does not matter. |
| Very large files show more changes than expected | See “How large can the texts be?” below. | Compare smaller sections. |
Examples
Each example was run through this page.
| Text 1 | Text 2 | Result |
|---|---|---|
The quick brown fox jumps over the lazy dog | The quick red fox jumped over the lazy dog | ~1 modified: brown/red and jumps/jumped highlighted |
timeout: 30retries: 3 | timeout: 60retries: 3 | ~1 modified: only 30/60 highlighted |
alpha beta gamma | one two three | +1 added, −1 removed (no words in common) |
one two three four (one per line) | three four one two (one per line) | +2 added, −2 removed; three and four match |
Hello | hello | +1 added, −1 removed; identical with To lowercase |
How the comparison works
Lines that are identical at the start and end of both texts are matched first. The rest is compared with a longest-common-subsequence algorithm, the same idea behind Unix diff and git diff: it finds the largest set of lines the two sides share in order, and everything else is an addition or a removal. Neighbouring removals and additions are then paired into modified lines, and each pair is compared again, word by word, with the same method.
Frequently asked questions
How large can the texts be?
Thousands of lines are fine. The full algorithm builds a table of every line pair in the part that differs, so when that part exceeds about four million pairs (roughly 2,000 lines on each side) a quicker one-pass match is used instead. It keeps the page responsive but can report reordered lines as removed and added where the full algorithm would have matched some of them.
Can it ignore white space or capital letters?
Yes. Tick Remove excess white space to ignore indentation and trailing spaces, and To lowercase to ignore case. Both also change the text shown in the result.
Why does a one-word change sometimes show as a whole removed line?
A changed line is only shown word by word when at least 30% of its words also appear in the other version. Short lines where most words changed are shown as a removal and an addition, which is usually easier to read.
Is this the same as a Git diff?
The algorithm family is the same, but Git prints a unified patch with context lines and +/- markers. This page shows the two versions side by side with word highlighting and does not produce a patch file.
Can I compare binary files such as Word documents or PDFs?
No. Only plain text can be compared. Copy the text out of the document first; formatting such as bold or fonts is not compared.
Is my text uploaded anywhere?
No. Both texts stay in your browser and the comparison runs there, so configuration files with credentials or customer data are not sent to a server.