Text Compare

Compare two texts online: added, removed and changed lines, with changed words highlighted. Ignore case or whitespace. Free, no sign-up, no upload.

  • Line-by-line diff
  • Changed words marked
  • Ignore case & spaces
  • Show only changes

Comparison result

Your text is compared in your browser and never uploaded or saved.

🔒 Everything is calculated in your browser. No data is sent to any server.

When to use it

  • Contract and document revisions: Compare two versions of a contract or proposal to see exactly which words were changed.
  • Code and config files: Without Git at hand, quickly diff two snippets of code or configuration.
  • Essays and assignments: Check what changed between drafts, or how much two texts have in common.
  • Translation and copy proofreading: Compare the before and after versions and tick “Show only changes” to review quickly.

How to use

  1. Paste the original text on the left and the changed text on the right, or use Load left file / Load right file. The comparison appears below as you type.
  2. Red rows marked − exist only on the left (removed) and green rows marked + exist only on the right (added). Changed lines appear as a pair, with the changed words highlighted in a darker shade.
  3. Tick Ignore case or Ignore whitespace to hide differences that don't matter. For long texts, tick Show only changes to fold away the unchanged parts.

Worked example

The built-in sample compares two versions of a SQL query: 5 lines on the left, 6 on the right, giving +3 and −2 lines (3 unchanged). Line 1 changes from COUNT(*) AS Cnt to SUM(Amount) AS Total, and only COUNT→SUM, *→Amount and Cnt→Total are highlighted, not the parentheses or AS. Right line 4, AND Status = 1, is a pure addition, and in the last comment line only 1→2 is highlighted.

Left: if (x == 1) {, then return TRUE;, then }. Right: if (x == 1) {, then return true;, then }. With no options you get +2 and −2 lines, with even the extra spaces highlighted. With Ignore whitespace only line 2 differs (+1, −1) and just TRUE→true is highlighted. Add Ignore case and all three lines match.

Reading the results

  • The +N and −N in the status line are added and removed line counts. A changed line counts as one removal plus one addition, so editing 3 lines shows +3 and −3.
  • The first two columns are line numbers: left (original) then right (changed). A row with only one number exists on only that side.
  • With Show only changes, 2 unchanged lines are kept before and after each change for context, and the rest collapse into a "N unchanged lines hidden" marker.
  • When an ignore option makes two lines equal, the row shows the right-hand text, so with Ignore case you see the new spelling.

How it works

  • Lines are compared with jsdiff, which implements Myers' O(ND) difference algorithm to find the fewest additions and removals that turn the left text into the right, the same idea behind git diff.
  • Each line can be normalized before comparing: Ignore whitespace collapses runs of whitespace and trims the ends, and Ignore case lowercases the line. Normalization is used only for matching; the original text is always displayed.
  • Adjacent removals and additions form a change block, and lines are paired in order for an in-line comparison. Chinese and Japanese are compared character by character, while English and code are compared by whole words so words aren't shredded into letters.
  • In-line highlights are skipped when the shared text is under 30% of the longer line. CRLF and CR line endings count as LF, and a single trailing newline is not a difference.
  • Opened files are decoded as UTF-8 first and fall back to Big5 when the bytes aren't valid UTF-8.

Limitations

  • Only plain text is compared; fonts, colors, tables and other formatting are not.
  • The comparison is line-based, so a paragraph that was only re-wrapped shows up as changed.
  • Moves aren't detected: a block moved elsewhere shows as a removal in one place and an addition in another.
  • Very large files with lots of changes stop after 5 seconds with an error; compare them in parts.
  • Only UTF-8 and Big5 files are decoded automatically. Save files in other encodings as UTF-8 first.

FAQ

Why aren't the changed words highlighted on some lines?

When less than 30% of a line pair is the same, the line has basically been rewritten, and word-level highlights would just color everything. Those lines are shown only as a removed line and an added line.

What does Ignore whitespace ignore?

Runs of spaces or tabs count as a single space, and spaces at the start and end of a line are ignored, so re-indenting or extra spaces don't show up as differences. Blank lines still count as lines.

Can I compare Word, PDF or Excel files?

Only plain-text files (such as .txt, .csv, .sql, .json or source code) can be opened directly. For Word, PDF or Excel, copy the content and paste it in. Formatting isn't compared.

Is my text uploaded?

No. The comparison runs entirely in your browser. Nothing is sent to a server or stored, and the text is gone when you close the page.

Can I use it to check for plagiarism?

It shows which parts of two texts are identical, but only for the two texts you paste in. It doesn’t search other articles online and isn’t a formal plagiarism checker.

Why is the whole paragraph marked as changed?

Usually the line breaks differ, for example one side breaks after every sentence while the other has the whole paragraph on one line. Make both sides use the same line breaks first, or tick “Ignore whitespace” before comparing.

Can it compare very long texts?

Typical documents finish in a few seconds. If there are a huge number of differences and the time limit is exceeded, you’ll be told; compare a smaller part or split it into sections.

References