Text diff

Compare two texts and highlight the changes

All computation runs locally in your browser

Last updated: February 28, 2026
Frank Zhao - Creator
CreatorFrank Zhao

Introduction / overview

The Text Diff tool compares two pieces of text and visually highlights what was added, removed, or changed. It’s especially useful when the texts are mostly similar but you need to spot a few edits quickly.

Who is this for?

  • Writers comparing drafts, titles, or product descriptions.
  • Developers reviewing config changes (JSON, YAML, .env samples) at a glance.
  • Students comparing answers or checking what changed in notes.

Good to know: the comparison runs locally in your browser. If you share a link, include the text only when you explicitly enable “share with results”.

If you’re comparing structured data (like JSON objects), you may prefer our JSON diff calculator, which is designed for nested keys and arrays.

How to use (quick start)

  1. Paste your older version into the left pane (original).
  2. Paste your newer version into the right pane (modified).
  3. Scroll through the highlights to review changes line-by-line.
  4. When you’re done, use Reset to go back to the default sample text.

A quick “sanity-check” example

Suppose the only change is a number inside a sentence:

Original: Order quantity: 12
Modified: Order quantity: 15
Δq\Delta q==151215 - 12==33

In the diff view, you should see a single small edit — exactly what you expect. If you see many scattered changes, it often means whitespace or line endings differ (see tips below).

Step-by-step examples

Example 1: Compare two short paragraphs

  1. Paste paragraph A on the left and paragraph B on the right.
  2. Look for highlighted phrases that were rewritten.
  3. Confirm the meaning stayed the same, or note what changed.

If you want to estimate how much changed, a quick (imperfect) heuristic is “changed characters divided by total characters.”

pp==12120\frac{12}{120}×100%\times 100\%==10%10\%

The diff highlights are the authoritative view; the percentage is just a quick communication tool.

Example 2: Compare two lists (line-by-line)

  1. Put each item on its own line (one item per line).
  2. Compare the list order and look for additions/removals.
  3. If many lines show as changed, try normalizing whitespace first.

For structured lists like JSON arrays and objects, you’ll usually get a cleaner comparison with JSON diff.

Real-world use cases

Editing marketing copy

Compare two versions of a headline or description to confirm what was rephrased (and what stayed consistent).

Reviewing configuration changes

When a config “suddenly breaks”, diff the known-good version vs the new one to spot a missing key, a typo, or a changed value.

Checking translations

Compare two translations of the same text to see which segments were changed, added, or removed.

Common scenarios / when to use

You rewrote a paragraph

See exactly which phrases changed without manually scanning two documents.

You updated a changelog

Confirm the latest release notes only added the intended entries.

You suspect whitespace issues

A diff makes hidden changes (extra spaces, missing newlines) obvious.

You need a quick review pass

A side-by-side view is ideal for “before/after” validation.

You changed some numbers

Spot numeric edits and verify they match your intended update.

You are comparing structured JSON

Prefer JSON-aware comparison with our JSON diff tool.

Try JSON diff.

When a diff is not the best fit: if your “text” is really data (nested JSON), or if you need semantic meaning (like code-aware refactors), a specialized tool will be more accurate.

Tips & best practices

  • Keep one item per line when possible. Line-based diffs are easier to read than giant paragraphs.
  • If you see “everything changed”, check for line endings (Windows vs Unix) or pasted formatting.
  • For privacy, avoid sharing sensitive content. If you must share, prefer sharing without results.
  • If your text is JSON, you’ll often get better results using JSON diff.

Avoid a classic mistake

If you compare two texts that are logically identical but formatted differently, the diff can look “noisy”. A simple way to reduce noise is to normalize whitespace before you compare (for example, trimming trailing spaces).

Calculation method / formula explanation

Most diff tools build a “best alignment” between the original and modified text, then mark the smallest set of insertions and deletions. A common building block is the Longest Common Subsequence (LCS).

LCS recurrence (conceptual)

dp[i,j]={dp[i1,j1]+1if ai=bjmax(dp[i1,j],dp[i,j1])otherwise dp[i,j] = \begin{cases} dp[i-1,j-1] + 1 & \text{if } a_i = b_j \\ \max\big(dp[i-1,j],\,dp[i,j-1]\big) & \text{otherwise} \end{cases}

Here, aia_i and bjb_j are characters (or tokens) from two versions. The diff viewer uses algorithms like this (plus optimizations) to decide which parts match and which parts changed.

Related concepts / background info

What counts as a “change”?

A diff typically represents changes as insertions and deletions. A “replacement” is usually shown as a deletion plus an insertion. That’s why a single edited word can appear as two operations under the hood.

Why JSON diffs can look messy in plain text

JSON is structured data. When formatting changes (indentation, key order), a plain text diff can highlight many lines. A JSON-aware diff compares parsed structures, which is often easier to read.

Try JSON diff when you’re comparing objects and arrays.

FAQs, limitations, sources

Why does it say everything changed?

The most common cause is formatting differences: extra spaces, different line endings, or pasted rich-text artifacts. Try normalizing whitespace or ensuring both versions use consistent newlines.

Can I edit both sides?

Yes. The left pane is the original text and the right pane is the modified text; both are editable so you can iterate quickly.

Is my text uploaded anywhere?

The comparison runs in your browser. However, if you enable “share with results”, the text is embedded in the URL. URLs can be logged or shared accidentally, so use that option only when appropriate.

What are the limitations of a text diff?

A text diff is syntactic, not semantic. It doesn’t understand meaning, intent, or refactors. Re-ordering blocks can also make diffs harder to interpret.

Where can I learn more?

If you want deeper background, look up concepts like “diff”, “Longest Common Subsequence (LCS)”, and “edit distance”. For structured data, use tools designed for that format.

Limitations / disclaimer

This tool helps you compare text, but it can’t guarantee that two versions are “equivalent” in meaning. Always review important documents carefully.

External references / sources

  • General background on file comparison and diff concepts (search terms: “diff utility”, “LCS”, “edit distance”).
  • Monaco Editor documentation for editor and diff viewer behavior.