diff
A diff is a line-by-line comparison of two versions of text or program code, showing what was added, deleted, or changed.
In plain terms
Imagine you receive two versions of a contract and want to know what was changed. Instead of reading both in full, you put them side by side and mark the differences with a highlighter. A diff tool does the same automatically, in moments: it shows only the difference, not the full text.
In most current tools, the display is similar: deleted lines are red and have a minus sign in front, while new lines are green and get a plus sign. If a line has been modified, you usually see it as a deleted line and an added line one below the other. Many tools also highlight the changed words within a line.
It is a daily tool for developers because software is built from a series of small changes, and every change is reviewed in diff form before being accepted. In the AI era, it has become even more important: when a coding agent touches your files, the diff shows exactly what it changed. This is your most important control point.
How is it different from Word's track changes? The diff does not record modifications during editing but compares two completed states afterward. It works on any two text files, even if no one tracked what happened in between. (Word's 'Compare' function is actually such a post-hoc comparison.)
How it works
- The program receives the two versions, the old and the new, and breaks both down into lines.
- It identifies the lines that appear in the same order in both versions. This is the common skeleton; everything else is measured as a deviation against it.
- Items appearing only in the old version are marked for deletion (minus, red in most tools), while those appearing only in the new version are marked for addition (plus, green).
- It organizes differences into small blocks and places a few unchanged lines next to each one so you can see which part of the file you are viewing.
- The result can be saved, sent to someone else, and applied on top of the old version, which turns it into the new one. Sending changes and code review rely on this, and version control systems show as a diff what changed between two states.
An everyday example
You ask a coding agent to fix a bug in your webshop's code. Before saving anything, it shows you the diff: three red lines disappear, five green lines appear. You then decide whether to approve the change.
Who is affected
A common misconception
Limits and risks
- Diff compares text, not meaning: it cannot tell whether the program still works correctly after a change.
- Large, multi-hundred-line diffs are hard to read carefully, and coding agents often produce such changes, making it easy to overlook an important detail.
- For images, Word or Excel files, and other non-simple text formats, traditional diff is barely usable; these require special tools.
- Formatting changes (indentation, line breaks, reordering) can create a large diff even if the content has not actually changed.
Similar, but not the same
- patch (folt) – A patch is usually the diff saved to a file, intended to be applied to another instance. A diff describes the differences, and a patch is the form of this description meant for transmission and application.
- commit – A commit is a saved state in version control with an author, timestamp, and comment, while a diff shows only the differences between two states.
- Track Changes – Change tracking logs who edited what while the editing happens, whereas a diff compares two finished versions afterward, without any edit history.
Related concepts
A brief history
Diff was originally the name of a Unix command created by Douglas McIlroy and James Hunt at Bell Labs; the program appeared in the fifth Unix release in 1974, and their paper describing the algorithm was published in 1976. The name is an abbreviation of the English word difference.
Where things stand
For decades, it has been a basic tool of software development, part of every version control system and code editor. By the end of 2026, due to coding agents, non-developers will also encounter it more frequently, because agents typically show suggested changes in diff format.
In the news
- Ethan Mollick publishes Portals, a browser-based 3D experience of 471 generated worlds built by agent teamsNov 9, 2026 · Code
- Hungarian HR leaders' main concerns: demographics, AI, pay transparency and reskillingNov 4, 2026 · Work & HR
- Stakeholders offer competing views on how FDA should regulate generative AI in medtechNov 3, 2026 · Health
- Researcher: AI tools affect middle schoolers differently from college studentsNov 2, 2026 · Education & Family
- Retailers restrict or block third-party AI agents as Walmart and Amazon take different approachesOct 26, 2026 · Marketing
- Kreatív Online study: AI cites you but recommends your competitorOct 26, 2026 · Marketing
- Hungarian agencies and providers prepare the market for AI answers with GEO training and explainersOct 26, 2026 · Marketing
- Surveys: young people often turn to chatbots for emotional difficulties and health questionsOct 26, 2026 · Health
Also known as
diff · diffing · diff file · changelog · unified diff · git diff · code diff · file comparison
Sources
This entry was machine-edited and has undergone machine expert review; the “In the news” section updates automatically from Agent Age stories.