Skip to content

Compare two text blocks and compute line-by-line additions, deletions, and unified diff output.

Loading tool

About Text diff

Compares two blocks of text line by line and shows additions and deletions side by side or inline, with the changed words highlighted within modified lines. Whitespace and case differences can be ignored. It also produces a standard unified diff (patch) with adjustable context lines that can be copied or downloaded as a .diff file.

Common uses

  • Compare two versions of a config file, log or document
  • Find what changed between two pasted code snippets
  • Create a patch file from a before and after version of a file
  • Check whether two texts differ only in whitespace

FAQ

What is a unified diff?
A unified diff lists changes in hunks starting with @@ -start,count +start,count @@, with removed lines prefixed by -, added lines by + and unchanged context lines by a space. It is the format produced by git diff and diff -u.
Can I apply the generated patch with git?
The output uses original.txt and modified.txt as file names, so edit the --- and +++ header lines to match your file paths before running git apply or patch.
What does 'Ignore whitespace' do?
Lines are compared after collapsing runs of whitespace into one space and trimming the ends, so indentation and trailing-space changes are not reported.