Skip to content

Diff Checker

Compare two texts line by line and see exactly what changed.

Runs entirely in your browser

Both texts are compared in your browser. Neither is uploaded, which makes this safe for contracts, configuration and logs.

Two versions of something and a nagging sense that they are not the same: a config file that worked yesterday, a contract clause someone edited without saying which one, a log from a machine that is failing next to a log from one that is not. Reading them side by side and hoping to spot the difference is slow and unreliable, especially when the difference is one character.

More about Diff Checker

This tool compares them line by line and marks what was added, what was removed and what stayed. It uses the Myers difference algorithm — the same approach git uses — which finds the smallest set of changes that turns one text into the other. That matters for readability: a naive comparison that gives up at the first mismatch marks the entire rest of the file as changed, which tells you nothing.

Three options control what counts as a difference. Ignoring whitespace hides re-indentation, which is what you want when someone ran a formatter over the file. Ignoring case hides capitalisation, useful for comparing keys or identifiers. Ignoring blank lines hides paragraph spacing. Each is a deliberate choice, and the summary tells you when the texts are identical only because an option is on.

The result can be read two ways. Side by side is easier for prose and for spotting a moved block; unified — the format `diff -u` and every code host use — is easier for code, and can be copied straight into a patch or a review comment. The unified output is also downloadable as a `.diff` file with correct hunk headers.

Both texts stay in this page. That is worth saying plainly, because comparing two versions of something confidential is exactly the case where an online diff tool is a bad idea, and most of them upload.

  • Line-by-line comparison using the Myers algorithm, the same one git uses
  • Side-by-side and unified views, with changed lines paired rather than stacked
  • Counts of added, removed and unchanged lines
  • Options to ignore whitespace, case or blank lines, each stated explicitly
  • Adjustable context so the unified output shows as much or as little as you need
  • Copy the unified diff, or download it as a .diff file with correct hunk headers
  • Change markers are text, not only colour, so the result survives copying
  • Large comparisons run off the main thread instead of freezing the tab

How to use it

  1. 1Paste the original version into the left box.
  2. 2Paste the changed version into the right box.
  3. 3Read the marked result: green is added, red is removed.
  4. 4Turn on an ignore option if formatting changes are drowning out real ones.
  5. 5Switch to the unified view to copy or download a patch-style diff.

Questions

What is a unified diff?

It is the format `diff -u`, git and every code host produce: changed lines prefixed with + or -, surrounded by a few lines of context, with headers saying which lines each hunk covers. It can be applied as a patch.

Why is the whole file marked as changed?

Usually a line-ending or indentation change applied to every line. Turn on "ignore whitespace" and see whether the real differences appear; if they do, something reformatted the file.

Can it compare two files rather than pasted text?

Open each file in a text editor and paste the contents in. Everything stays in your browser either way, and pasting avoids any question about which file was read.

Does it show which words changed within a line?

Changed lines are paired opposite each other in the side-by-side view, so a one-word edit is easy to see. The comparison itself is line-level, which keeps it fast on large files.

Why does a large comparison need a button?

The algorithm is fast on similar texts and slow on two large texts with little in common. Past a size threshold the comparison waits for you to ask and then runs in a background thread, so the page stays responsive.

More Developer Tools
Esc

16 results