Canonical: https://toolipedia.app/unified-diff-patch-tool

# 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.

Breadcrumbs: Toolipedia > Developer tools > Code and developer utilities > Unified Diff Patch Tool

## 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?
- Private: everything happens in your browser. Nothing you enter is uploaded.
- Free, with no sign-up, no watermark and no limit on how often you use it.
- Works on phones, tablets and computers: Android, iPhone, Windows, Mac and Linux. Nothing to install.

## Also known as
- unified diff patch tool
- create patch file online
- apply patch online
- diff two texts to patch
- make a unified diff

## 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.

## Related tools

More free tools that go well with Unified Diff Patch Tool:
- [Git Diff Viewer](https://toolipedia.app/git-diff-viewer)
- [JSON Patch and Pointer Tool](https://toolipedia.app/json-patch-and-pointer-tool)
- [SQL Schema Diff](https://toolipedia.app/sql-schema-diff)
- [Config File Key Diff](https://toolipedia.app/config-file-key-diff)
- [Dependabot Config Generator](https://toolipedia.app/dependabot-config-generator)
