Menu

Text Compare

Paste the original text on the left and the changed text on the right to see every added, removed and changed line, with the words that differ highlighted inside each changed line.

View

Paste two texts to see the differences.

Both texts are compared in your browser and never uploaded.

How to compare two texts

  1. Paste the first version into Original text and the second version into Changed text. Text you were working on in another tool on this site is placed in the Original box automatically.
  2. Read the summary line under the options, for example 2 lines added, 1 removed, 2 unchanged. If nothing differs it says The texts are identical.
  3. Choose a View: Side by side puts the two versions in two columns, One column lists the old line above the new one.
  4. Tick Ignore case or Ignore spaces at line ends and repeated spaces if those differences do not matter to you, and untick Show unchanged lines to see only what changed.
  5. Use Swap to exchange the two boxes, Example to load a short sample and Clear to empty both.

The result updates as you type, so you can fix a line in either box and watch the difference disappear. For a longer walk-through, including comparing files and lists, see the guide on how to compare two texts.

How the comparison works

The comparison runs in two passes.

Lines first. Both texts are split into lines, and the tool finds the smallest number of lines to remove from the original and add to the changed text so that the two match, keeping the remaining lines in their original order. Every line is numbered with its position in its own text, so line 3 on the left can sit next to line 4 on the right after an insertion.

Then words. Inside each block of changes, the first removed line is paired with the first added line, the second with the second, and so on. Each pair is shown as one changed row, and the same matching is run again on its words to highlight only the parts that differ. Removed or added lines left over without a partner are shown alone.

The Example button shows both passes:

Original Changed Shown as
The quick brown fox jumps over the lazy dog. The quick red fox jumped over the lazy dog. Changed: brown → red, jumps → jumped
It was a sunny day. It was a sunny day. Unchanged
A new line was added here. Added
The end. The end. Unchanged

Summary: 2 lines added, 1 removed, 2 unchanged. The edited first line counts once as removed and once as added.

What counts as a word

Inside a changed line the text is split into tokens: runs of letters and digits, runs of spaces, and single punctuation marks. Apostrophes, hyphens and underscores between letters stay inside a word, so don’t, well-known and 2026-10-21 are each one token, while 3.5 is three (3, ., 5). Accented letters and letters from other alphabets count as letters.

A whole token is marked when any part of it changes, which keeps the highlights readable:

Before After Highlighted
Price: $20, due 2026-10-21 Price: $25, due 2026-11-01 20 → 25, 2026-10-21 → 2026-11-01
bananas blueberries the whole word
Hello World hello world Hello World → hello world

In the last row both words changed and the single space between them is merged into one highlight rather than shown as two separate changes. When the only thing removed or added is whitespace, each space is shown as · and each tab as →, so a b compared with a b highlights ·· → · between the letters and a removed ·· at the end.

The options in detail

Option What it does Example that becomes identical
Ignore case Compares lines in lowercase, including accented capitals Ünïcode café and ünïcode CAFÉ
Ignore spaces at line ends and repeated spaces Trims each line and treats any run of spaces or tabs as one space indented and indented; x[tab]y and x y
Show unchanged lines Hides matching lines when unticked; changes stay visible —

Ignoring spaces never removes a space entirely: ab and a b are still different. When an option makes two lines equal, side-by-side view shows each version as typed, and one-column view shows the original line with the changed spelling below it, for example Changed text: hello world.

Edge cases worth knowing

  • Line endings. Windows \r\n, old Mac \r and Unix \n line breaks are all treated as the same break, so a file saved on another system does not show every line as changed.
  • Final line break. a followed by a line break and a without one are identical; the trailing break does not create an empty last line.
  • Empty lines. An empty line is a real line. If the original has a blank line between paragraphs and the changed text does not, it is reported as one line removed. Clean both with Remove empty lines if blank lines do not matter.
  • Moved lines. Order matters. With one, two, three on the left and three, one, two on the right, three is shown as added at the top and removed at the bottom.
  • One empty box. If only one box has text, every line is reported as added or removed.
  • Large texts. Lines found in only one text are set aside before the search, so two 10,000-line documents with a few hundred edits compare in a fraction of a second. On very long input the tool waits a moment after you stop typing before redrawing.

When a text diff helps

  • Contract and policy changes. Paste the old and new version of terms, an agreement or a privacy policy to see exactly which sentences were edited. Keep one sentence or clause per line for the clearest result.
  • Editing and proofreading. Compare your draft with the version an editor or a grammar tool returned to see every word they touched.
  • Lists and exports. Find which emails, product codes or URLs were added to or dropped from a list between two exports. Sort both lists with Sort lines and remove repeats with Remove duplicate lines first, so order and duplicates do not create noise.
  • Configuration and code snippets. Spot the changed value in two versions of a config file or a short script, with Ignore spaces on if only indentation differs.
  • Copied text that looks the same. When two strings look identical but a form or a search treats them differently, the word highlights show where they differ. If no difference is visible, hidden characters may be the cause; Remove invisible characters strips zero-width spaces and similar marks.

Questions

Is my text uploaded when I compare it?

No. Both texts are compared by JavaScript in your browser tab and are never sent to a server, so you can compare contracts, code or drafts that must stay private.

Why is a line I only moved shown as removed and added?

The tool finds the smallest set of line removals and additions that turns the original into the changed text, keeping lines in order. A line that moved up or down cannot stay matched in both places, so it appears as removed where it was and added where it is now. To compare two lists regardless of order, run both through Sort lines first.

Can I compare two text files?

Open each file in a text editor, copy its contents and paste one into each box. Windows (CRLF) and Mac or Linux (LF) line endings are treated the same, and a missing final line break is not reported as a difference.

How do I compare two files in Visual Studio Code?

Run code --diff file1 file2 (or code -d) in a terminal to open the two files in VS Code's difference editor. For text that is not saved in files, pasting it here is quicker.

Why does the summary say 1 added and 1 removed when I changed only one word?

The summary counts lines. An edited line counts as one line removed (the old version) and one line added (the new version). The table pairs them in one row and highlights only the words that differ.

Can it ignore capital letters or extra spaces?

Yes. Tick Ignore case to treat "Hello" and "hello" as the same, and Ignore spaces at line ends and repeated spaces to ignore indentation, trailing spaces, tabs and doubled spaces. Spaces are never ignored completely, so "ab" and "a b" still differ.

Can I compare JSON or code?

Yes, as plain text. The tool compares line by line, so format both versions the same way first (for JSON, the same indentation and key order) to get a useful result. It does not understand the structure of the data.