# Unified Diff Generator

Compare two texts and get a unified diff in the format of diff -u and git diff. Paste the original and the changed text, name the files and choose how many lines of context to keep. The patch can be applied with patch, git apply or the Patch Apply tool.

## Frequently asked questions

### What does the output look like?

It starts with --- and +++ lines naming the original and changed file, followed by hunks that begin with @@ -start,count +start,count @@. Lines starting with a space are unchanged, - lines are removed and + lines are added.

### What does the context setting change?

It sets how many unchanged lines are shown around each change, from 0 to 20. Three lines is the default of diff -u and git diff, and enough for patch tools to find the right place.

### What does ignore whitespace do?

Lines that differ only in spaces or tabs are treated as equal, so changes in indentation or trailing spaces do not appear as changes.

### What does No newline at end of file mean?

This marker, also printed by diff and git, says that the last line of a text has no line break after it. It keeps the patch exact when one version ends with a newline and the other does not.

### Can I apply the result with git?

Yes. Save it as a .patch or .diff file and run git apply or patch -p0. Name the files as they are named in your repository, for example a/src/app.js and b/src/app.js with patch -p1.

### Why do I get an error for very different texts?

Computing a diff between two long texts that share almost nothing takes a lot of work. If the comparison takes longer than three seconds it is stopped, and you can compare smaller parts instead.

Your ad here?

[Email us](mailto:hi@dennn.is?subject=Advertising%20on%20OneClick%20Pro)

[Ad 433 tools for your AI agents through one MCP server.](https://multitaskai.com/?ref=oneclickpro)
