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.

Text 10 B
Text 20 B

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

  1. 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.
  2. Tick any of the four options below if you want differences in case, order, wrapping or spacing ignored.
  3. Click Compare, or press Ctrl+Enter (⌘+Enter on a Mac).
  4. Read the summary next to the buttons, for example +1 added −0 removed ~1 modified, or “The two texts are identical.”
  5. 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

Comparison options explained

Options change the texts before comparing, and the result shows the changed texts. They take effect when you click Compare.

Line endings are always normalised: Windows (CRLF), old Mac (CR) and Unix (LF) line breaks are treated as the same.

Common problems and fixes

SymptomCauseFix
A line is counted as modified but no word is highlightedThe 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 endOne 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 filesOne 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 differentThe 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 addedThe 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 expectedSee “How large can the texts be?” below.Compare smaller sections.

Examples

Each example was run through this page.

Text 1Text 2Result
The quick brown fox jumps over the lazy dogThe quick red fox jumped over the lazy dog~1 modified: brown/red and jumps/jumped highlighted
timeout: 30
retries: 3
timeout: 60
retries: 3
~1 modified: only 30/60 highlighted
alpha beta gammaone 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
Hellohello+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.

Related tools