Skip to content
Convertto

Unified Diff & Patch Generator

Produce a unified diff between two texts that git apply and patch can consume.

A unified diff records the changes between two versions of a file as hunks of context, removed and added lines. This generator computes the longest common subsequence, groups changes into hunks with the context you choose, and emits a patch that both git apply and the patch command accept.

Runs in your browser
Privacy
Runs entirely in your browser — nothing is uploaded
Cost
Free, unlimited, no sign-up

Frequently asked questions

What is the number in @@ -1,4 +1,5 @@?

The hunk header: the affected lines start at line 1 and span 4 lines in the original, and start at line 1 and span 5 in the new version. It is how patch finds the right place even if surrounding content has shifted.

How to use the unified diff & patch generator

  1. 1Enter or paste your original.
  2. 2Enter or paste your changed.
  3. 3Enter or paste your file name.
  4. 4Set the context lines.
  5. 5The result appears immediately — copy or download it.

Embed this tool

Put the working unified diff & patch generator on your own site. It runs in your visitors' browsers exactly as it does here — free, no account, nothing uploaded.

Share this tool

Last updated

More developer tools