.diff

What is a .diff file?

A diff file shows the line-by-line differences between two versions of a file — additions, deletions, and changes.

Safe format
Type Code
By Douglas McIlroy (Bell Labs)
MIME text/x-diff

Drop any file to identify it

No upload. No signup. No sending your file halfway across the internet.
We tell you what it is, right here in your browser.

What is it

A diff file is a text document showing exactly what changed between two versions of a file. Lines starting with `+` were added. Lines starting with `-` were removed. Context lines (unchanged) provide orientation. The format was invented for Unix in the 1970s and remains the foundation of every version control system.

Git generates diffs internally for every commit, merge, and pull request. `git diff` produces unified diff format. GitHub and GitLab render diffs with colour-coded highlighting. Code review is fundamentally the act of reading diffs and deciding whether the changes are correct.

Diff files can be applied as patches: `patch < changes.diff` applies the changes to the original file. This mechanism powered open-source collaboration before Git — developers emailed patches (diffs) to maintainers, who applied them to the codebase. The format is still used for distributing small fixes and security patches.

Technical details
Full Name
Diff File
MIME Type
text/x-diff
Developer
Douglas McIlroy (Bell Labs)
Magic Bytes
N/A
Safety
.diff is a known, safe format. Text file showing code changes. Safe to read. Applying a diff modifies files.
What opens it
VS Code
FREE Windows / Mac / Linux
Any text editor
FREE Windows / Mac / Linux
GitHub / GitLab (rendered)
FREE Web
FAQ
How do I read a diff file?
Lines starting with + are additions. Lines starting with - are deletions. Lines without a prefix are unchanged context. @@ markers show the line numbers. Open in VS Code for colour-coded rendering.
How do I apply a diff?
Run `patch < changes.diff` in the directory containing the original file. Or use `git apply changes.diff` in a git repository. Review the diff before applying.
Related formats