Plain Text Diff

Share:
Text Tools

Plain Text Diff

Compare two texts and highlight the differences

By Checked against sources by Last reviewed DEVELOPER TOOLS DIFF TEXT COMPARISON TEXT TOOLS
Your browser is too old for this tool’s interactive features. Please update to Safari 13.1, Chrome or Edge 80, Firefox 74 or newer.

Plain Text Diff

📅 Research current as of 09 Nov 2026 · Sources: Myers (1986) for the shortest edit script and its linear-space refinement; Git's diff-options documentation for its default and --minimal; GNU diffutils manual for the unified format
Standards, published formulas, and reference data are revised over time — check against a current authoritative source before relying on these figures.
Advertisement
After tool · AD-W1Responsive · Post-tool

How to Use the Text Diff Tool

Paste both versions

Put the original text on the left and the changed text on the right. They can be anything: code, prose, configuration, lists.

Set comparison options

Optionally ignore case or whitespace, which is handy when formatting or capitalisation is noise, or normalise Unicode so that two spellings of the same accented letter count as equal.

Compare

Press "Compare" and the differences are highlighted line by line — additions in green, deletions in red, and within changed lines the exact words that differ are marked, so you can see precisely what moved.

Switch views

Toggle between side-by-side (old and new in two columns) and inline (a single list with + and − markers). Unchanged stretches are hidden down to three lines of context unless you untick that. Copy the result as a unified diff to paste into a patch or a code review.

Advertisement
After how-to · AD-W2Responsive

Seeing Exactly What Changed

The Problem Diffs Solve

When two versions of a document look almost the same, spotting what actually changed by eye is slow and error-prone — you read both, lose your place, and miss the one altered number that mattered. A diff tool does that comparison for you, instantly and exactly. It is a staple of software development, where every code review and version-control commit is built on diffs, but it is just as useful outside it: a writer comparing two drafts of an article, a lawyer checking what changed between contract versions, a translator aligning a revised text, or anyone who has received an "updated" file and needs to know what is new. This tool takes your two texts and highlights every difference line by line — additions in green, deletions in red — and within a changed line it goes further, marking the precise words that differ so a single edited phrase doesn't make the whole line look rewritten.

Underneath is the O(ND) algorithm Eugene Myers published in 1986. Git builds on it too, but its default takes shortcuts to save time (its documentation calls it "the basic greedy diff algorithm"), and a separate --minimal option switches them off to produce the smallest diff. This tool computes the exact shortest edit script, the same line counts as git diff --minimal, up to the limit described below. A shortest edit script is the same thing as a longest common subsequence: the largest set of lines that appear in both texts in the same order. Everything else is an addition or a removal. A comparison that walked both texts in lockstep would, after one inserted line, mark everything below it as changed; this one sees those lines as unchanged and shifted down, and reports the one real insertion. The work grows with the number of differences rather than with the size of the files, so a long file with a few changes is quick. The two view modes serve different habits: side-by-side is best for reading old and new in context, while inline is the compact format used in code reviews.

What It Treats as a Line, and Its Limits

A line ends at a line feed, a carriage return plus line feed, or a lone carriage return, so a Windows file and a Unix file compare equal. A newline at the very end finishes the last line rather than starting an empty one, and the summary says so if only one text has it. Comparison is exact by default, down to the Unicode code unit. That means the precomposed letter é and the letter e followed by a combining accent count as different even though they look the same, which is what the Normalise Unicode option is for: it compares both texts in Normalization Form C. The tool flags changed lines that may look identical because of this or because of an invisible character. Ignore case is simple lower-casing, not full Unicode case folding, so "Straße" and "STRASSE" stay different. Within a changed line, words are split at spaces and punctuation, and Chinese and Japanese are compared character by character because they do not put spaces between words. Thai has no spaces either and is compared in runs, so a change there marks the whole run.

Two limits are deliberate, so that large input cannot freeze the page. Past 4,000 added or removed lines, which is about 2,000 edited lines because an edited line counts as one removal and one addition, a guaranteed shortest script is no longer attempted. The tool lines the texts up on lines that occur exactly once in each, then diffs each stretch between them with a search that has a step budget. Where the budget runs out, the search splits at the furthest point it reached and carries on, so repetitive text such as CSV rows or log lines still gets a real diff rather than every line marked as changed. The result is correct, and the summary tells you it may not be the smallest. The display stops at 5,000 rows, and the copied unified diff still has everything.

Private by Design

The comparison runs entirely in your browser: the tool does not upload, store or transmit your two texts, and it keeps working offline once the page has loaded. That is not the same as a sealed room. Like any web page, this one can run other scripts, including ads where you have allowed them, and browser extensions can read what is on the page. For a document that must not be exposed at all, use diff on your own machine. The optional ignore-case and ignore-whitespace settings let you focus on substantive changes: ignore-whitespace collapses runs of spaces and trims both ends of each line so that reformatting doesn't show up as a difference, and ignore-case treats "Hello" and "hello" as the same, which is useful when capitalisation is not the change you care about.

Longest common subsequence is why one inserted line doesn't redden the rest

01

A diff finds the longest common subsequence of lines, then marks the rest as added or removed.

02

The original diff utility came from Bell Labs Unix: Hunt and McIlroy described its algorithm in 1976.

03

Myers' 1986 algorithm does work in proportion to the differences. Git's default takes shortcuts; git diff --minimal switches them off and asks for the true shortest, which is what this tool computes.

Frequently Asked Questions

  • Paste the original text on the left, the changed text on the right, and press "Compare". The tool highlights every difference line by line — additions in green, deletions in red — and marks the exact words that differ within changed lines. You can switch between a side-by-side and an inline view, and optionally ignore case or whitespace.
  • Side-by-side shows the original and changed texts in two columns, aligned so you can read them in context — best for prose and documents. Inline shows a single unified list with + for added lines and − for removed ones, the familiar format from code reviews and patch files. Both highlight the same differences; pick whichever you find easier to read.
  • Both. It works at the line level first, then for lines that were changed rather than wholly added or removed, it does a second word-level comparison and highlights just the words that differ. So if you change one word in a long sentence, only that word is marked — the rest of the line is shown as unchanged context.
  • No. The comparison runs in your browser, and the tool does not upload, store or transmit your texts. It keeps working offline once the page has loaded. As on any web page, though, browser extensions and any third-party scripts the page loads can see what is on it, so for material that must not be exposed at all, run diff on your own computer.
  • Ignore case treats "Hello" and "hello" as identical, using simple lower-casing, so "Straße" and "STRASSE" still differ. Ignore whitespace collapses runs of spaces and tabs to one space and trims both ends of each line, so extra indentation or trailing spaces don't show up. It does not remove spaces altogether: "ab" and "a b" still differ.
  • Yes. It works on code, configuration files, JSON, CSV and any text, and the Copy as unified diff button gives you the same format as diff -u. The hunks can sit a line or two differently from what diff or Git print, because they slide a change to a preferred position and this tool does not; both are correct patches. If you have ticked an ignore option, the copied patch shows the original lines, so it describes what you compared rather than an exact byte-for-byte patch.
  • It uses Myers' algorithm, which finds a shortest possible set of line changes, so an inserted line near the top doesn't make everything below it look changed. Two limits apply. "Changed" lines are paired in order within a run of removals and additions, which is a display choice rather than proof that one became the other. And past 4,000 added or removed lines (about 2,000 edited lines) the result is correct but may not be the smallest, and the tool says so.
  • There is no limit on what you paste, but there are limits on the work. Up to 4,000 added or removed lines you get a shortest diff, past that an anchored one with a bounded search, and the display stops at 5,000 rows while the copied unified diff keeps everything. The work is bounded, so a huge paste costs seconds at worst rather than crashing the tab.
  • Yes. Paste the old and new versions and the tool shows which lines and words changed, which is faster and more reliable than re-reading both by eye. For legally significant changes, have the final wording reviewed by the appropriate professional, and see the note above on confidential text.
  • Because the characters differ even though they render the same: an accented letter can be stored as one code point or as a letter plus a combining mark, and a no-break space or a zero-width character looks like nothing at all. The summary counts such lines. Tick Normalise Unicode (NFC) to treat the two spellings of an accented letter as equal; Ignore whitespace covers a no-break space.

Method & sources

How it computes

Line diff by Myers' O(ND) algorithm: the exact shortest edit script, as git diff --minimal gives, up to 4,000 added or removed lines. Past that the texts are aligned on lines unique to both and each gap diffed by a linear-space Myers search with a step budget; the page says the result may not be minimal. A word-level diff runs inside changed lines. A line ends at LF, CRLF or CR. Exact unless ignore-case, ignore-whitespace or NFC is ticked. Runs in the browser.

What this tool implements

  • Myers (1986) shows that finding a longest common subsequence and finding a shortest edit script are the same problem, solved in O(ND) time, where D is the size of the minimum edit script (Myers 1986, abstract), with a refinement that needs only O(N) space. In a line diff an edited line is one removal plus one addition. This tool computes the exact script. Git's default takes shortcuts that --minimal switches off (its documentation calls the default the basic greedy diff algorithm); the GNU diffutils manual calls its own default near-minimal.
  • Hunt and McIlroy, Bell Labs Computing Science Technical Report #41 (July 1976): the central algorithm of Unix diff solves the longest common subsequence problem.
  • Work is bounded so large input cannot freeze the page: at most 4,000 line edits (added plus removed, so about 2,000 edited lines) for a guaranteed shortest script; past that an alignment on lines unique to both, each gap diffed by a step-limited search that is valid but possibly not minimal, which the page states; 200 word edits per line, then the whole line is marked; 5,000 rendered rows, with the copied diff complete.
  • Copy as unified diff follows the GNU diffutils unified format, including the marker for an incomplete last line, and was checked against real diff -u output. Hunks can sit a line or two from where diff or Git put them, because those slide change groups; the line counts are the same.
  • Comparison is by UTF-16 code unit unless an option is ticked. Normalise Unicode compares in Normalization Form C (UAX #15). Ignore case is String.prototype.toLowerCase, not Unicode case folding.
  • Corrected 2026-11-02: full-table memory use, empty input and a final newline counted as lines, Chinese and Japanese treated as one word, and a privacy claim the page could not keep. Corrected 2026-11-09: past the cap, repetitive text was marked entirely changed (20,000 lines of 8 values with 2,500 rewritten gave 40,000 changed lines where git diff --minimal gives 4,328); Git's default was called a shortest edit script; the Myers link pointed at an unauthorised copy.

Sources

Advertisement
Pre-footer · AD-W3 728 × 90