Skip to content

Text Diff

Compare two texts and see exactly what changed, line by line with changed words marked, or word by word, and download the differences as a patch.

  • Free, no sign-up
  • Runs in your browser
  • Sources cited
Compare by
View

Differences

3 added2 removed2 unchanged44.4% similarChange 1 of 2
Line 1 in the originalDelivery termsLine 1 in the changed textDelivery terms
Line 2 in the originalOrders ship within 3 business days.Line 2 in the changed textOrders ship within 2 business days.
Line 3 in the originalReturns are accepted for 30 days.Line 3 in the changed textReturns are accepted for 30 days.
Line 4 in the originalContact support by email.Line 4 in the changed textRefunds go to the original card.
Line 5 in the changed textContact support by email or chat.

Unified patch

The standard format of diff -u and git diff, which patch and git apply can read.

--- terms-v1.txt
+++ terms-v2.txt
@@ -1,4 +1,5 @@
 Delivery terms
-Orders ship within 3 business days.
+Orders ship within 2 business days.
 Returns are accepted for 30 days.
-Contact support by email.
+Refunds go to the original card.
+Contact support by email or chat.

How to use the text diff

  1. Paste or open both versions

    Put the original on the left and the changed text on the right, or open a file on each side. The comparison updates as you type.

  2. Choose how to compare

    Compare whole lines, with the changed words marked inside each changed line, or compare word by word or character by character for prose and short strings.

  3. Pick a view

    Side by side lines up both versions; unified shows removed lines with a minus and added lines with a plus, like git diff.

  4. Ignore what does not matter

    Ignore spaces at the ends of lines, letter case, or the difference between Windows and Unix line breaks.

  5. Step through and export

    Jump from change to change, then copy or download the unified patch.

How text comparison works

A diff finds the smallest set of insertions and deletions that turns one text into the other; everything else is unchanged. The tool uses Eugene Myers’ algorithm, published in 1986, which finds that smallest set efficiently when the two texts are mostly alike.

In line mode, each line is a unit. Where lines were removed and added at the same place, the tool pairs them and runs a second, word-level diff on each pair, so a one-word edit in a long line is easy to spot. Word mode treats words and the spaces between them as units; character mode compares every character, which suits codes, identifiers and short strings.

The patch uses the unified format that git documents and diff -u writes: a header naming both files, then hunks that start with @@ and the line ranges, followed by the changed lines with - or + and a few unchanged lines of context. Tools such as patch and git apply can read it to make the same change elsewhere.

Worked example

The example compares two versions of some delivery terms. The original has 4 lines and the changed text 5. The diff finds 2 unchanged lines, 2 removed and 3 added, so the texts are 44.4% similar.

In the changed line about shipping, only the word “3” became “2”; the rest of the line is unchanged and stays unmarked. The patch begins with the hunk header @@ -1,4 +1,5 @@.

Understanding the result, and common mistakes

Similarity
Unchanged lines as a share of all lines on both sides. Identical texts are 100% similar.
Changed line
A line removed and a line added at the same place, shown as a pair with the words that differ marked.
Identical apart from the options
The texts differ only in what you chose to ignore, such as case or line breaks.
  • Invisible differences. Trailing spaces, tabs and Windows line breaks make lines differ; use the ignore options to check whether that is all.
  • Comparing reformatted text by line. If paragraphs were rewrapped, compare by words instead.
  • Expecting moved blocks to show as moves. A diff shows a moved paragraph as removed in one place and added in another.

Frequently asked questions

Are my texts uploaded?

No. The comparison runs in your browser, and shared links carry only the settings and file names, never the texts.

Can I compare files?

Yes. Open a text file on each side, up to 2 MB each. Code, CSV, JSON and plain text all work.

What is a unified diff?

The standard text format for differences, used by diff -u, git and code review tools. Download it as a .patch file to apply the change elsewhere.

How do I compare JSON or code that was reformatted?

Format both sides the same way first, for example with a formatter, then compare by lines.

Sources

  1. Eugene W. Myers: An O(ND) difference algorithm and its variationsAlgorithmica (Springer) · retrieved Nov 14, 2026
  2. Generating patch text with -pGit · retrieved Nov 14, 2026

About these results

  • The comparison runs in your browser. Nothing you paste or open is uploaded.