Wapgee Logowapgee

Tools / Diff checker

Diff checker

Compare two versions of any text, whether it is code, a config file, or a document, and see exactly what changed. Choose a unified or side-by-side view, ignore whitespace or case, spot changes within a line, and download the result as a .patch file.

Original
Changed
Result
Paste text above to see a diff.

What a diff actually shows you

A diff is the shortest list of edits that turns one text into another. Rather than reading two versions side by side and hunting for differences, you get only the lines that were removed, the lines that were added, and enough unchanged context to know where you are. This tool uses the Myers algorithm, the same approach git uses, so the result matches what you would see in a pull request.

The output is grouped into hunks. Each hunk starts with a header such as @@ -12,6 +12,8 @@, which means the hunk covers six lines starting at line 12 in the original and eight lines starting at line 12 in the changed text. Lines that start with - were removed, lines that start with + were added, and lines with a leading space are unchanged context. The +N / −N counter above the result totals the added and removed lines so you can size a change at a glance.

Unified or side by side

The unified view is the compact one: a single column with removals and additions interleaved. It is the format reviewers know from git and the one you copy into a ticket or a chat message, because it survives being pasted as plain text.

Side by side puts the original on the left and the changed text on the right with dual line numbers. It is easier on the eyes when a block was rewritten rather than tweaked, because you can read each version as prose instead of mentally reassembling it from - and + lines. Switch between the two with the view toggle; the underlying diff is the same.

Ignoring whitespace and case

Two options change what counts as a difference. Ignore trailing whitespace treats return x; and return x;   as the same line, which removes the noise an editor adds when it strips or pads line endings. Ignore case treats Hello and hello as equal, useful for prose, log output, or SQL where capitalisation is not meaningful.

Leave both off when you are reviewing code that will be committed: a stray trailing space is a real change there, and a reformatter will keep reintroducing it until someone sees it.

Spotting a one-word change

Line-level diffs are blunt: change one word in an 80-character line and the whole line shows as removed and re-added. Within-line highlighting runs a second, character-level pass on each paired removal and addition and marks only the characters that differ, so a renamed variable or a flipped comparison operator stands out without re-reading the line.

Original
if (user.age >= 18) {
  grantAccess(user);
}
Changed
if (user.age > 18) {
  grantAccess(user);
}

In the example above, the line-level diff reports one removed and one added line. Within-line highlighting narrows it to the single missing =, which is the kind of change that slips past a reviewer scanning a long diff.

Exporting and applying a patch

The download button saves the unified diff as a .patch file with standard --- and +++ headers. That is the format git apply and the classic patch utility read, so a diff you produce here can be applied to a file elsewhere:

git apply changes.patch
# or, outside a repository:
patch -p0 < changes.patch

This is handy when you want to send someone a precise edit without sending the whole file, or when you are comparing two exported configs and want to carry the difference into version control. When the diff only needs to be read rather than applied, the copy button puts the same unified text on your clipboard instead.

Where it earns its keep

  • Comparing two environment or YAML config files to find the one setting that differs between staging and production.
  • Checking what an AI assistant or a formatter changed in a block of code before you accept the edit.
  • Reviewing a contract, policy, or article revision when the author did not track changes.
  • Confirming that two log excerpts are the same apart from timestamps, with ignore trailing whitespace turned on.

Everything runs in your browser and nothing is uploaded, so it is safe for secrets and unpublished drafts. If the text you are comparing is HTML, the HTML to Markdown tool can first reduce both versions to readable Markdown so the diff shows content changes instead of markup churn.

FAQ

Is my text uploaded to a server?

No. The diff runs entirely in your browser, so the original and changed text never leave your device.

What format is the downloaded .patch file?

A standard unified diff (--- / +++ headers and @@ hunks), the same format git apply and patch(1) expect.

When should I use ignore trailing whitespace or ignore case?

Turn them on when you care about content rather than formatting, for example when comparing logs that pad lines differently, or prose where capitalization differs.

What does within-line highlighting do?

On paired delete/insert lines it runs a character-level Myers pass and marks the characters that actually changed, so you can spot a one-word edit without re-reading the whole line.