ToolLaunchpad
Text tools

Text Diff Checker

Paste an original and a changed version to see every added and removed line. Switch to word or character mode to spot small edits, and copy the result as a unified diff.

Text Diff CheckerRuns in your browserCtrl+Enter runs

  • 0Lines added
  • 0Lines removed
  • 0Lines unchanged

Differences

+ added - removed

Runs entirely in your browser. Nothing you enter is uploaded or stored.

How to use the text diff checker

  1. Paste the older version into Original text and the newer one into Changed text. The comparison updates as you type.
  2. Read the result: lines starting with + were added, lines starting with - were removed, and unchanged lines have no marker. Line numbers for both versions are shown on the left.
  3. Switch the mode to Word level or Character level to see small edits inside a line. Added text is underlined, removed text is struck through.
  4. Use Ignore case or Ignore whitespace to hide differences that do not matter, and Swap to reverse the direction.
  5. Press Copy unified diff to get the changes in the same format as diff -u or git diff.

Both texts stay on your device; the comparison runs in your browser, so you can compare contracts, configuration files or code without uploading them.

Worked example

Original:

Shopping list
Apples
Bread
Milk
Cheese
Coffee beans

Changed:

Shopping list
Apples
Wholegrain bread
Milk
Coffee beans
Orange juice

The statistics show 2 lines added, 2 removed and 4 unchanged. The unified diff is:

--- original.txt
+++ changed.txt
@@ -1,6 +1,6 @@
 Shopping list
 Apples
-Bread
+Wholegrain bread
 Milk
-Cheese
 Coffee beans
+Orange juice

A changed line appears as one removal plus one addition. In word mode the same edit is shown inside the running text, so you can see exactly which words were replaced.

How the comparison works

The tool uses the jsdiff library, which implements the Myers algorithm: it finds the longest sequence of lines that both texts share and reports everything else as the smallest possible set of insertions and deletions. In word mode the same algorithm runs on words, and in character mode on single characters, which is useful for typos or changed numbers.

The unified format starts with --- and +++ headers. Each hunk header such as @@ -1,6 +1,6 @@ means: starting at line 1, six lines of the original correspond to six lines of the new version. Up to three unchanged context lines are kept around each change, and changes that are close together share one hunk. Lines in the hunk start with a space for context, - for removed and + for added. Windows line endings are normalised and a missing final newline is added, so these do not show up as false differences. To clean texts before comparing, try remove duplicate lines or remove line breaks.

Common mistakes

  • Trailing spaces – two lines that look identical may differ by a space at the end. Tick Ignore whitespace to hide these.
  • Re-wrapped paragraphs – if one version has different line breaks, the line mode marks whole paragraphs as changed. Use word mode instead.
  • Reversed inputs – additions and removals are relative to the original. If everything looks backwards, press Swap.
  • Invisible characters – text copied from a word processor can contain non-breaking spaces or curly quotes that look like normal ones. Character mode reveals them as changes.
  • Comparing formatted data – for JSON, format both versions the same way first with the JSON formatter, otherwise indentation changes hide the real edits.

Frequently asked questions

Are my texts uploaded to compare them?

No. The comparison runs in JavaScript in your browser, and neither text is sent to a server.

What is the difference between line, word and character mode?

Line mode compares whole lines and is best for code and lists. Word mode highlights changed words inside lines, which suits prose. Character mode shows single changed letters or digits.

What does Ignore whitespace do?

In line mode, lines that differ only in spaces or tabs at the start or end count as unchanged. In word mode, differences in the amount of space between words are ignored.

Can I use the unified diff with git or patch?

The output follows the unified format with --- and +++ headers and @@ hunks, so tools such as patch can usually apply it. Adjust the file names in the header to match your files.

How are added and removed lines shown without colour?

Every added line starts with a plus sign and every removed line with a minus sign. In word mode, added text is underlined and removed text is struck through.

How large can the texts be?

Texts with thousands of lines work fine. If two very large texts differ almost everywhere, the comparison stops after a few seconds and asks you to compare smaller parts.

More free Launchpad tools