Diff & Patch Generator
Create unified diff patches online — compare two texts into a .patch file with configurable context, or apply a patch back (even reverse). GNU patch compatible format.
Unified diff output
--- a.txt
+++ b.txt
@@ -1,5 +1,5 @@
function greet(name) {
- const msg = "hello " + name;
+ const msg = `Hello, ${name}!`;
console.log(msg);
- return msg;
+ return msg.trim();
}
\ No newline at end of file
About Diff & Patch Generator
Paste the original and modified text to get a standard unified diff — ---/+++ headers, @@ hunks with configurable context lines, "No newline at end of file" markers — ready to feed to git apply or GNU patch.
Flip the direction and apply a pasted patch to a source text: hunks are verified against context with an offset search like real patch, failures are reported per hunk, and reverse mode undoes a patch. Everything runs locally in your browser.