Tools›Developer
›Patch File Generator
Patch File Generator
Paste two versions of a file to generate a unified diff .patch file. Download it or apply it with patch -p0 < file.patch.
✅ No differences found — the texts are identical.
Frequently Asked Questions
What is a unified diff / patch file?
A unified diff is a standard text format that records the differences between two files. Lines starting with + were added, lines starting with - were removed, and context lines (no prefix) help locate the change. The format is accepted by tools like patch, git apply, and most code review platforms.
How do I apply the downloaded .patch file?
Run patch -p0 < file.patch in the same directory as your files. For Git repositories, use git apply file.patch. Use patch -R -p0 < file.patch to reverse (undo) a patch.
What does the context lines setting do?
Context lines are unchanged lines shown around each change to help patch locate where to apply the change. The standard is 3 lines. More context makes patches more resilient; fewer makes them shorter.
What's the difference between unified diff and normal diff?
Unified diff (the format generated here) combines added and removed lines in a single block, making it easier to read. Normal diff shows them in separate blocks. Unified diff is the standard for open source patches and git diff.