Diff checker for text and code

Paste two versions and see every changed line side by side, with syntax highlighting and the exact words that moved. It all runs in this tab, so nothing is uploaded.

Magenta plate: only in the original Cyan plate: only in the changed version
15 lines
15 lines
Loading the comparison…

How to compare two texts

  1. Paste the older version on the left and the newer one on the right, or drop a file on each box.
  2. Read the result: magenta lines exist only in the original, cyan lines only in the changed version, and lines with both colours were edited in place.
  3. Tighten the comparison with Ignore whitespace, Ignore case or Ignore blank lines when formatting noise hides the real edits.
  4. Switch to Unified for a git-style view, then copy or download the patch.

Built for code review

Syntax highlighting covers about twenty languages, from JavaScript, TypeScript and Python to Go, Rust, SQL and YAML. It is detected from the content or the file name, and you can override it from the menu. Long unchanged stretches fold away so the edits stay on one screen, and one click brings the hidden lines back.

Magenta and cyan were chosen instead of the usual red and green because they stay distinct for the most common forms of colour blindness. Every changed line also carries a − or + sign, so colour is never the only cue.

Need the story behind the change rather than the lines? Explain changes writes a short summary, points out risky edits and suggests a commit message. New to reading diffs? The guide on how to read a git diff walks through hunk headers and the algorithm step by step.

Questions people ask

Is my text uploaded anywhere?

No. The comparison runs in JavaScript inside your browser tab, so the text never reaches a server. The only exception is the optional “Explain changes” button: when you press it, the patch (not your whole files) is sent to an AI model to write the explanation.

Which diff algorithm does DiffKit use?

Lines are matched with the Myers O(ND) algorithm, the same approach GNU diff and git use by default. Lines that changed in place are then compared a second time word by word (or character by character) so you can see exactly which part of the line moved.

Can I compare two files instead of pasting?

Yes. Drag a file onto either box or use “Open file”. Files up to 5 MB are read locally. The file extension also picks the syntax highlighting language automatically.

What does “changed in place” mean?

When a removed line and an added line at the same spot are still mostly alike (at least about a third of the characters in common), DiffKit shows them side by side as one modified line and highlights the words that differ, instead of listing a full delete and a full insert.

How do I get a patch file for git?

Click “Download .patch” or “Copy patch”. You get a standard unified diff with three lines of context, which `git apply` and `patch -p0` both accept.

Why are some lines shown as unchanged when I tick “Ignore whitespace”?

With that option, runs of spaces and tabs count as a single space and leading or trailing whitespace is dropped before lines are compared. Re-indented code then stops showing up as changed, which is useful when reviewing a reformat.

Other comparisons