Text Diff Checker

Paste an original and a revised version and see exactly what was added and removed, by line, word or character.

What a diff actually computes

Finding the difference between two texts means answering one question: what is the smallest set of deletions and insertions that turns the original into the revision? That is the same problem as finding thelongest common subsequence (LCS) of the two lists — the longest run of items that appears in both, in the same order, though not necessarily next to each other. Everything in the LCS is "unchanged". Whatever is left over is a deletion if it exists only in the original and an insertion if it exists only in the revision. The number of edits is therefore length of original + length of revision − 2 × LCS length.

This tool uses the classic dynamic-programming approach: it fills a table of LCS lengths and then walks back through it to read off the edits. Time and memory grow with the product of the two lengths, so the tool first trims whatever is identical at the start and end of both texts and only runs the table on the part in between. If that product is still too large, it shows a message instead of freezing the tab (see the limits below). Git's default diff is based on a different algorithm published by Eugene Myers in 1986, which runs faster when the two versions are similar. Both aim for a minimal set of edits; when several minimal answers exist they may pick different ones, so the placement of removed and added lines can differ slightly.

A table you can follow by hand

Below is the standard textbook pair of strings, ABCABBA (original) and CBABAC (revision). Each cell holds the LCS length of everything from that position to the end, so the top-left cell is the LCS length of the whole. The numbers were computed by the same recurrence used by the tool when this page was built.

Original \ RevisedCBABACend
A4432210
B4432110
C4332110
A3332100
B3322100
B2222100
A1111100
end0000000

Result: the LCS has length 4. With 7 items in the original and 6 in the revision, the minimum number of edits is 7 + 6 − 2×4 = 5. The same idea with whole lines is easier to feel. Take an original of "apple / banana / grape" and a revision of "apple / strawberry / grape / orange". The LCS is "apple, grape", which has length 2, so the edit count is 3 + 4 − 2×2 = 3: one line removed (banana) and two lines added (strawberry and orange). Paste those lines into the boxes above to see the same answer.

Lines, words and characters

Line mode suits anything where a line is a unit of meaning: source code, configuration files, lists and clauses of an agreement. It is fast and the output is compact, but a single changed word makes the whole line look deleted and re-added. To compensate, when a removed line and an added line sit next to each other, the tool compares them again word by word and shades the words that actually changed. Word mode is better for prose written as long lines, such as reports and article drafts, where you want to see which phrase was reworded.Character mode is for catching a typo, a single wrong digit, or a one-character mistake in something like an account number or a URL. On long text it can be slow, and coincidental matching letters can break the result into fragments that are hard to read, so use it on short passages.

ModeBest forStrengthWatch out for
LineCode, configs, lists, clausesFast, short outputA one-word edit marks the whole line (in-line highlighting softens this)
WordLong sentences, reportsShows the reworded phrasePunctuation stays attached to the word it touches, so "end." and "end" count as different
CharacterNumbers, names, URLsCatches one-character differencesSlow on long text; the result can look shredded

When to use the whitespace and case options

If the content is the same but the indentation changed, or trailing spaces make every line look different, choose "Ignore leading/trailing whitespace" and only the real edits remain. Text pasted from a word processor often has doubled spaces, in which case "Collapse repeated whitespace" is the right choice. "Ignore case" helps with ordinary prose where only capitalisation changed, but turn it off for code, where userId anduserID are different names. These options only affect the comparison; the output still shows your original text. Line endings are normalised on input, so a Windows file (CRLF) and a Unix file (LF) do not make every line appear different.

How to read the result and where it helps

Green marks what exists only in the revision (added), red marks what exists only in the original (removed). When reviewing a contract or terms of service revision, scan by line first, then re-check only the changed lines word by word. For code and config, use line mode with whitespace ignored so that only meaningful changes show. If you are comparing JSON, run both sides through the JSON formatter first so indentation is the same and harmless differences vanish. After revising a cover letter or essay, theword counter will show how the length changed. If two strings look identical but the tool says otherwise, switch to character mode: the culprit is often an invisible character such as a non-breaking space, a zero-width character, or an accented letter stored as two code points instead of one. And if you plan to rewrite names in bulk after spotting a pattern, try the expression in theregex tester before applying it.

Privacy, limits, and when not to use this tool

Everything you paste is processed in your browser; nothing is uploaded or stored. The practical limit is memory. The LCS table holds one 32-bit number per cell, and the tool refuses to build it when the number of cells would exceed 25,000,000 — roughly 100 MB, or about 5,000 items on each side of the part that differs after the identical beginning and end are trimmed. In line mode that is thousands of lines, but in character mode it means a few thousand characters, so for a long document use line mode or split the text. When the limit is hit, you get a message rather than a result.

A diff does not understand moves. If you cut a paragraph and paste it elsewhere, it appears as a deletion in one place and an insertion in another. The tool compares plain text only, so it cannot report formatting changes, tables or images in Word or PDF files. The in-line highlight pairs nearby removed and added lines in the order they appear, so it can pair the wrong lines if a block was heavily reordered. There is no three-way merge or version history; for team code, use a version-control system. And for a legally binding document, a person should always make the final check against the original.

Frequently Asked Questions

Only one word changed, but the whole line is red or green. Why?

That is how line comparison works. When a removed line and an added line are paired, the changed words inside them are shaded more strongly, so look for the darker highlight. If you would rather see only the phrase, switch to word mode.

What is the difference between "Ignore leading/trailing whitespace" and "Collapse repeated whitespace"?

The first strips spaces only at both ends of each item before comparing. The second also treats any run of spaces or tabs inside the item as a single space, so a doubled space between words no longer counts as a difference.

Why does it say the texts differ when they look identical?

Common causes are invisible characters (non-breaking or full-width spaces, zero-width characters), trailing spaces, accented letters stored in different Unicode forms, and capitalisation. Try the options above, then character mode to locate the exact difference.

Does it detect moved lines?

No. A moved line appears as removed in one place and added in another, which is typical of LCS-based diffs.

Can the result differ from Git's diff?

Yes, slightly. When more than one minimal set of edits exists, different algorithms choose different ones. Git uses a Myers-style algorithm (with other options available), so the position of some removed and added lines may differ even though the edit count is the same.

What format does "Copy diff" use?

In line mode, unchanged lines are prefixed with two spaces, removed lines with "- " and added lines with "+ ". In word and character mode, removed text is wrapped as [-...-] and added text as [+...+].