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 @@?
How to use the unified diff & patch generator
- 1Enter or paste your original.
- 2Enter or paste your changed.
- 3Enter or paste your file name.
- 4Set the context lines.
- 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
Related tools
Compare Two PDFsSee two versions side by side, overlaid or wiped between — with every changed area outlined.Text Diff CheckerCompare two texts and highlight exactly what was added and removed.Git Command BuilderBuild the exact git command for fifteen common tasks, with explanations and safety notes..gitignore GeneratorBuild a .gitignore file for your stack, with the entries people usually forget.JSON DiffCompare two JSON documents and see exactly which keys were added, removed or changed.Semantic Version CheckerTest versions against a range, sort by precedence, or compare two releases.
Last updated
More developer tools