Text Diff Checker

A diff checker lines up two versions of a text and marks what was removed, added or left alone. Paste both versions here to see changed lines side by side, with the exact words that differ highlighted inside each line. Everything is compared in your browser, so drafts, contracts and source code never leave your device.

Reading the result
MarkMeaningWhere
Red line, minus signOnly in the originalLeft column
Green line, plus signOnly in the changed versionRight column
Darker highlight inside a lineThe words that changedBoth columns
Plain lineSame in bothBoth columns

Updated

Use it for contract revisions, website copy edits, config files or two copies of a function. For structured JSON, where key order should not matter, the JSON diff checker linked below compares values rather than lines.

Compare two texts

Paste the original on the left and the changed version on the right. Changed lines are paired side by side with the exact words highlighted, and you can switch to a single-column view or copy a plain-text report.

Showing changes on your own page

HTML has elements for exactly this, so a published change log can mark edits without images.

Marking edits with del and ins

del marks removed text and ins marks added text. Screen readers do not announce them by default, so the CSS adds hidden words that are read aloud.

<style>
  del { background: #fde8e8; }
  ins { background: #e3f6e8; text-decoration: none; }
  del::before { content: "removed: "; position: absolute; clip-path: inset(100%); }
  ins::before { content: "added: "; position: absolute; clip-path: inset(100%); }
</style>
<p>Monday to Friday: <del>8am</del> <ins>7am</ins> to 6pm</p>
<p>Sunday: <del>closed</del> <ins>10am to 2pm</ins></p>

The core idea in a few lines

A small longest-common-subsequence table, the same approach the checker uses, before the head and tail shortcuts and word-level pass.

function diff(a, b) {
  const n = a.length, m = b.length;
  const dp = Array.from({ length: n + 1 }, () => new Array(m + 1).fill(0));
  for (let i = n - 1; i >= 0; i--)
    for (let j = m - 1; j >= 0; j--)
      dp[i][j] = a[i] === b[j] ? dp[i + 1][j + 1] + 1 : Math.max(dp[i + 1][j], dp[i][j + 1]);
  const out = [];
  let i = 0, j = 0;
  while (i < n && j < m) {
    if (a[i] === b[j]) { out.push("  " + a[i]); i++; j++; }
    else if (dp[i + 1][j] >= dp[i][j + 1]) out.push("- " + a[i++]);
    else out.push("+ " + b[j++]);
  }
  while (i < n) out.push("- " + a[i++]);
  while (j < m) out.push("+ " + b[j++]);
  return out.join("\n");
}

console.log(diff(["a", "b", "c"], ["a", "c", "d"]));

How the comparison works

The checker splits both texts into lines and finds the longest run of lines the two versions share, in order. Everything outside that shared run is either a removal or an addition. This is the same idea behind most diff programs, which is why the result looks familiar if you have used version control.

When a removed line sits next to an added one, the pair is treated as an edit and compared again word by word. That is how a single changed time in a long sentence lights up on its own instead of the whole line turning red and green.

Options that change what counts as different

Ignore case treats Sunday and sunday as the same line. Ignore spacing collapses runs of spaces and tabs and trims line ends, which hides indentation changes in code or stray spaces pasted from a document. Ignore blank lines drops empty lines before comparing.

These options affect which lines match, not what is displayed: the right column always shows the changed text exactly as you pasted it.

Limits

Comparison needs memory proportional to the line count of one text times the other. To keep your browser responsive the tool stops at about six million line pairs, roughly two texts of 2,400 lines each, and says so instead of freezing. Lines shared at the start and end are skipped quickly, so long files with a few edits in the middle work best.

It compares plain text only. Formatting from Word or PDF is lost when you paste, and moved paragraphs show up as a removal in one place and an addition in another.

How it works

  1. Paste the original into the left box and the new version into the right, or use Swap to flip them.
  2. Tick any of ignore case, ignore spacing or ignore blank lines.
  3. Read the side-by-side view, or switch to the single column view, which is easier on a phone.
  4. Copy the report, which writes + before added lines, - before removed ones and folds long unchanged stretches.

Tips

Frequently asked questions

Is my text stored or uploaded?

No. Both texts stay in this browser tab and are compared by code running on the page. Closing the tab discards them.

Can I compare code with this?

Yes. It works on any plain text, including source code and config files. Turn on ignore spacing if you only changed indentation and want to see real edits.

Why does a moved paragraph show as removed and added?

A line diff keeps lines in order. When a block moves, the shared run is found on one side of it, so the block appears as deleted in its old spot and inserted in its new one.

What is the largest text it can compare?

About six million line pairs, for example 2,400 lines against 2,400 lines. Lines that match at the start and end are skipped before the heavy part, so files with few changes go further.

Related: JSON diff checker, JSON formatter, HTML formatter, CSS formatter, Regex cheat sheet.

Start for free or see all free tools. We.Inc is free to start, with no card needed. AI building is on paid plans from $20 a month.

More in Free Tools

We.Inc is an AI-powered website builder you can resell under your own brand. Launch a branded client dashboard, bill on Stripe Connect, and deliver AI-generated websites in minutes. White-label plans start at $99 a month for 25 client sites, with a 7-day free trial and no per-site fees.

Product

Who It's For

Features

Resources

Company

View Sitemap