← All text tools

Unified Diff Patch Tool

Create a unified diff patch from two texts, with your choice of context lines, or apply an existing patch to an original text and get the patched result.

  • Free
  • No sign-up
  • Works on any device

About Unified Diff Patch Tool

Two jobs in one tool. Create mode compares an original text with a changed one line by line using the Myers difference algorithm and writes a unified diff with the number of context lines you choose and a git style or plain header. Apply mode takes an original text and a patch and returns the patched text, looking for each hunk at its stated line and a little above or below if the text has moved. A hunk that does not match stops with an error instead of guessing. Missing final newlines are recorded and restored the way git does it.

How to use Unified Diff Patch Tool

  1. Choose Create a patch or Apply a patch.
  2. For creating, paste the original and the changed text and set the file name and context lines; for applying, paste the original text and the patch.
  3. Copy or download the patch or the patched text.

Why use this tool?

Also known as

Frequently asked questions

Can I apply the created patch with git or patch?

Yes. With the git style header, git apply works on it, and patch -p1 does too. The plain header is meant for patch -p0 or for reading.

What if a hunk does not match my text?

The tool reports which hunk failed and does not change anything. Check that you pasted the right original, or tick the option to ignore differences in spaces when matching.

How big can the texts be?

Thousands of lines are fine. If the two texts differ in more than about 4,000 places the comparison stops with a message, because the work grows quickly with the number of changes.

Is Unified Diff Patch Tool free?

Yes. Unified Diff Patch Tool on Toolipedia is free to use, with no sign-up and no watermark.

Is it safe to use?

Yes. Everything is worked out in your browser, and nothing you enter is sent to our server.

Does it work on my phone?

Yes. It works in any modern browser on Android and iPhone, as well as on tablets and computers. There's nothing to install.

Do I need an account?

No. Just open the page and use the tool. There's no sign-up and no email needed.