Skip to content
ToolPlankDEV
Text Tools
100% In-Browser Execution

Updated:

Text Diff Checker

Paste two versions of a text and this text diff shows what changed. Compare by line, word or character, ignore case, spaces or blank lines, switch between side by side and unified views, and copy the result as a patch. Nothing is uploaded.

Processing in browser...

Loading the tool. It runs entirely in your browser, so your data is never uploaded.

More free tools you may need next.

Quick Guide

How to use Text Diff

Simple step-by-step instructions to get the exact output you need.

  1. 01

    Add the two versions

    Put the original text in Text A and the changed text in Text B. Type, paste, press Paste, press Open file, or drop a text file on either box. Press Example to see a short project update compared with its edited version.

  2. 02

    Pick how to compare

    Lines is the default and also marks the changed words inside each changed line. Words suits prose. Characters suits short strings such as codes, IDs and typos. Tick Ignore case, Ignore whitespace, Trim trailing spaces or Ignore blank lines when those differences do not matter to you.

  3. 03

    Read the result

    Side by side puts Text A on the left and Text B on the right. Unified shows one column with removed lines marked - and added lines marked +. The strip above the result counts what was added, removed and unchanged and gives a similarity percentage.

  4. 04

    Copy or download the changes

    In Lines mode, Copy patch gives a unified diff you can paste into a code review or apply with patch tools. In Words and Characters mode you get the text with removals in [- -] and additions in {+ +}. Swap A and B flips the direction.

What a Text Diff Shows

A text diff lists the smallest set of edits that turns one text into another. Everything the two versions share is kept as context, and only the parts that differ are marked: removed parts come from Text A, added parts come from Text B. A diff checker saves you from reading two long versions line by line and hoping you spot the change.

Here is the Example from this page. Text A is a short project update. In Text B the status and deadline changed, one task was removed, one was added and the note moved from Monday to Tuesday. In Lines mode the tool gives this patch:

diff
--- text-a.txt
+++ text-b.txt
@@ -1,9 +1,9 @@
 Project update
 Owner: Ana Silva
-Status: on track
-Deadline: March 3
+Status: at risk
+Deadline: March 10
 Tasks:
 - write the draft
-- review the budget
 - send the invite
-Notes: call the venue on Monday
+- book the room
+Notes: call the venue on Tuesday

The summary reads: 4 lines added, 4 lines removed, 5 lines unchanged. 55.6% similar. On the page, the words that changed inside each pair of lines are marked too, so you see on and track replaced by at and risk without comparing the lines yourself.

How the Comparison Works

The tool splits both texts into units: lines, words or characters. It then finds the longest run of units the two texts share in the same order, using the Myers difference algorithm, the same idea behind git diff and the classic Unix diff. Units outside that shared run are the changes.

  • Common lines at the start and end are matched first, so a small edit in a long file is found quickly.
  • Lines that appear in only one text are set aside before the main search, because they can never match.
  • The search uses memory in proportion to the text size, not the square of it, so a 2 MB file does not exhaust the browser.
  • Each removed line is paired with a similar added line nearby, and those two lines get a word level comparison of their own.

When two large texts differ in a great many places, the tool stops refining the busiest areas after a fixed amount of work and marks those blocks as changed in full. Every change is still shown, and a note says when this happened.

Compare Two Texts by Line, Word or Character

Lines mode is right for code, configuration files, lists and logs. Words mode is better for paragraphs, where one edited word would otherwise mark a whole long line. For example, comparing The cat sat on the mat. with The cat sat on the red mat! in Words mode gives:

Text
The cat sat on the {+red +}mat[-.-]{+!+}

That is 2 words added, 1 word removed, 6 words unchanged. 80% similar. Punctuation counts as its own word, so a changed full stop is easy to see. Characters mode catches the smallest edits. Comparing Invoice INV-20481 with Invoice INV-20418 gives Invoice INV-204[-8-]1{+8+}, which shows two swapped digits at once.

What Each Option Does

  • Ignore case: Hello and hello count as the same.
  • Ignore whitespace: in Lines mode every space and tab inside a line is ignored, so x = 1; matches x=1;. In Words and Characters mode any run of spaces, tabs and line breaks counts as one space.
  • Trim trailing spaces: spaces and tabs at the end of a line are ignored. Leading indentation still counts.
  • Ignore blank lines: empty and whitespace-only lines are left out of the comparison. Line numbers still refer to the original text.
  • Unchanged lines around each change: how much context the result and the patch keep around each change, from 0 lines to the full text.
  • Wrap long lines: wraps long lines in the result instead of scrolling sideways.

With Ignore case and Trim trailing spaces on, a query written as SELECT id, name / FROM users with a trailing space and the same query in lower case give: No differences once the ignore options are applied. The page says so plainly rather than claiming the texts are identical.

Reading a Unified Diff Patch

The patch uses the unified diff format that git, GitHub and most code review tools understand. The first two lines name the files. Each block starts with a header such as @@ -1,9 +1,9 @@, which means the block covers 9 lines starting at line 1 in Text A and 9 lines starting at line 1 in Text B. Lines starting with a space are context, - means removed and + means added.

If you open files, their names go into the header. If one text ends with a line break and the other does not, the patch adds the standard marker line:

diff
--- text-a.txt
+++ text-b.txt
@@ -1,2 +1,2 @@
 timeout = 30
-retries = 3
\ No newline at end of file
+retries = 3

When any ignore option is on, context lines are copied from Text A and lines the options hid are left out, so such a patch is for reading and may not apply cleanly with a patch tool.

When to Use a Diff Checker and Its Limits

Use it to check what an editor changed in a contract or article, compare two exports of a configuration file, review a generated file before you commit it, or find the one changed value in two long logs. If order does not matter and you only want to know which items appear in one list and not the other, Compare Two Lists answers that more directly.

  • Each text can be up to 2,000,000 characters, and Lines mode compares up to 300,000 lines per text.
  • The view draws the first 2,000 rows. Copy and Download always include every change.
  • Windows (CRLF) and Unix (LF) line breaks are treated as equal, and a note says when the two texts use different ones.
  • It compares plain text. Word documents, PDFs and images are not read.
  • Moved blocks show as removed in one place and added in another. The tool does not detect moves.

Messy spacing can hide the real changes. Run both texts through Remove Extra Spaces first, or put lines in a stable order with Sort Lines when order does not matter. Remove Duplicate Lines helps when repeated lines make the diff noisy.

Diff Two Files From the Command Line

The patch on this page matches what these commands print, so you can move between the browser and the terminal.

Bash
diff -u text-a.txt text-b.txt
git diff --no-index text-a.txt text-b.txt
git diff --no-index --word-diff=plain text-a.txt text-b.txt

The last command prints the same [- -] and {+ +} markers that Words mode copies. In Python, difflib.unified_diff produces a unified diff from two lists of lines.

Privacy

Both texts are compared in your browser, in a background worker on this page. They are not uploaded, stored or logged. See the Privacy Policy for details.

Frequently Asked Questions

Technical Q&A for Text Diff

Common questions about edge cases, character encoding, and privacy guarantees.

Paste the original into Text A and the new version into Text B. The differences appear right away, with removed parts marked - and added parts marked +.

Side by side shows Text A on the left and Text B on the right, with matching lines lined up. Unified shows one column with removed and added lines one after the other, like a git diff.

Yes. Tick Ignore whitespace, Trim trailing spaces or Ignore case, and differences of that kind no longer count. Ignore blank lines leaves empty lines out as well.

Yes. Choose Words or Characters under Compare by. Words suits prose, Characters suits short strings such as codes and IDs.

It is twice the number of unchanged units divided by the total units in both texts. Two identical texts score 100% and two texts with nothing in common score 0%.

Yes. In Lines mode, Copy patch and Download give a unified diff in the same format as diff -u and git diff. In Words and Characters mode you get the text with [- -] and {+ +} markers.

Each text can be up to 2,000,000 characters, about 2 MB. The comparison runs in a background worker, so the page stays usable while large texts are compared.

No. CRLF and LF line breaks are treated as equal, and a note tells you when the two texts use different ones.

No. Both texts are compared in your browser and never leave your device.