Skip to content
cliplimeClipLime

Compare two texts and see the differences

Paste an original and a changed version. Added and removed parts are marked, counted, and ready to copy as a patch.

Two texts

0 characters, 0 lines

0 characters, 0 lines

Differences

Paste or type in both boxes, or press Example. The differences appear here as you type.

Both texts are compared in this tab. Nothing is uploaded.

At a glance

What it does
Compares two texts and shows what was added, what was removed and what stayed the same, with counts.
Three levels
Compare by lines, words or characters. In lines mode, the words that changed inside a changed line are marked too.
Views and options
Side by side or inline (inline on a narrow screen), ignore whitespace, ignore case, and Only changes, which folds long unchanged stretches and keeps 3 lines around each change.
Output
Counts of additions and removals, a similarity percentage, and a unified diff you can copy or download, the format of diff -u.
Algorithm
Myers' shortest edit script, written for this site, using memory in proportion to the text, not to the number of changes.
Limits
If the texts are very long and very different, the search stops after about a second and the middle is shown as one changed block. The page says when that happens.
Privacy
Both texts stay in your browser. Nothing is uploaded or stored.

How to do it

  1. 1

    Paste or load both texts

    Put the original on the left and the changed version on the right. You can type, paste, or load a text file into either box.

  2. 2

    Choose how to compare

    Pick Lines for code, config files and lists, Words for writing, or Characters to find a single changed letter.

  3. 3

    Set the options

    Switch on Ignore whitespace or Ignore case if those differences do not matter. Use Only changes to hide the lines that did not change.

  4. 4

    Read or copy the result

    Removed parts are marked coral and added parts mint. Copy the result as a patch, or download it.

Lines, words or characters

The level you pick decides what counts as one piece of text, and so what can be reported as changed.

  • Lines is the classic diff, the one used for source code, configuration files, CSV exports and lists. A line is either the same or it is not. When a removed line and an added line sit side by side, the words that differ are marked inside them, so you can see that only a date changed and not the whole line.
  • Words suits prose. A word is a run of letters, so don't is one word, and 3.14 is one number. Each punctuation mark is its own piece, and spaces are compared but not counted.
  • Characters finds a single typo in a name, an ID or a short string. It compares one visible character at a time, so an accented letter or an emoji counts once.

How the comparison works

The tool looks for the longest sequence of pieces that both texts share, in the same order. Everything outside that sequence is a removal (it is only in the original) or an addition (it is only in the changed text). This is the shortest edit script of Eugene Myers' 1986 algorithm, the same idea behind diff and Git.

Because only order matters, a paragraph that has been moved shows up as removed in one place and added in another. The tool does not try to detect moves. When two different edit scripts are equally short, either one is correct, and you may see a different one than another tool shows.

Ignoring whitespace and case

Ignore whitespace treats any run of spaces, tabs and line breaks as one space. In lines mode, each line is trimmed and its inner runs of spaces are collapsed before it is compared, which hides re-indentation and trailing spaces. In words and characters mode, a run of whitespace is one piece, so a b and a b match, and so do a b and a line break between a and b.

Ignore case compares everything in lower case. In both options the text you see is still the original text, only the comparison is relaxed.

Reading the counts and the patch

Added and removed are counts of pieces at the level you chose: lines, words or characters. Similarity is twice the number of shared pieces divided by the number of pieces in both texts together, so identical texts score 100% and texts with nothing in common score 0%.

In lines mode you can copy the result as a unified diff. It starts with --- original and +++ changed, then lists each change with three lines of context in @@ blocks. In words and characters mode the copy uses the markers [-removed-] and {+added+} inside the running text.

Questions people ask

How do I compare two files?

Use Load a file above each box, or drop a text file onto a box. The files are read on your device and never uploaded. It works with any plain text format, such as .txt, .md, .csv, .json and source code. It cannot read Word or PDF files.

Why is a moved paragraph shown as removed and added?

The comparison only looks at the order of the pieces, not at where text went. A paragraph that moved is gone from one place and new in another, so both are reported. No simple diff can tell a move from a delete and an insert.

What does the similarity percentage mean?

It is the share of the two texts that is the same. Twice the shared pieces divided by all pieces in both texts. The pieces are lines, words or characters, depending on the level you chose, so the same pair of texts can score differently at each level.

Can I apply the copied patch?

In lines mode the copy is a standard unified diff, so tools such as patch and git apply can apply it to the original file. The file names in its header are only labels (original and changed). If your tool checks them, edit those two lines. The patch follows the boxes exactly: a text that does not end with a line break gets a \ No newline at end of file line, as diff writes it, so add the final line break to the box if your file has one. The patch uses plain line breaks (LF). For a file with Windows (CRLF) line endings, ask your tool to ignore whitespace (patch -l or git apply --ignore-whitespace).

What does the notice about coarse form mean?

For very long texts that share very little, an exact comparison can take a long time. After about a second the tool stops, keeps the shared start and end, and shows the part in between as one changed block. Compare by lines, or compare shorter parts, to get the full detail.

Is my text uploaded anywhere?

No. The comparison runs in your browser. Nothing is sent to a server and nothing is stored.

Guides that help

All Text guides →