Skip to content

Text Compare

Compare two texts and see every added, removed and changed line highlighted.

Updated · Examples checked by automated tests

LOCAL WORKSPACENO UPLOAD REQUIRED

0 lines

0 lines

About Text Compare

Spotting what changed between two versions of a document by reading them side by side is slow and unreliable — the eye skips over a single altered word or a line that moved. A diff does the comparison mechanically and shows only what actually differs.

This tool aligns the two texts, marks each line as added, removed, changed or unchanged, and highlights the individual words that differ within a changed line. Case, whitespace and blank lines can each be ignored, and the result can be copied or downloaded as a standard unified diff.

How Text Compare works in your browser

The comparison uses Myers’ O(ND) difference algorithm — the same approach underneath git diff. It finds the shortest edit script that turns the left text into the right one, which is why it aligns matching blocks correctly instead of declaring everything after a single inserted line to be different.

Identical prefixes and suffixes are trimmed before the algorithm runs, so comparing two large documents that differ in the middle is fast. Within a changed line, a second word-level pass highlights the specific words that moved, unless the line has changed so completely that highlighting every word would add nothing.

The ignore options change equality without rewriting inputs. For example, compare “Status: Open” with “Status: Closed” to isolate a changed word. Disable ignore-case and whitespace options when auditing configuration or code, where those changes can matter. This is a textual diff, not a semantic comparison: equivalent JSON with different key order can still differ.

When to use it

  • Finding what changed between two versions of a config file or a contract.
  • Checking whether a copied block of code differs from the original in any way beyond formatting.
  • Diffing two API responses to isolate the field that changed.
  • Comparing documents under NDA, where a hosted diff tool would mean uploading both versions.

Worked examples

Find the changed value in two config files

Settings: All ignore options off, Unified view

Input

ORIGINAL
timeout = 30
retries = 3
mode = fast
CHANGED
timeout = 60
retries = 3
mode = fast
log = on

Expected output

--- Original
+++ Changed
-timeout = 30
+timeout = 60
 retries = 3
 mode = fast
+log = on

The edited line is shown as a removal followed by an addition, and the appended line as a plain addition. Unchanged lines keep a leading space, the same convention as git diff.

Check whether two texts differ only in case and spacing

Settings: Ignore case and Ignore whitespace on

Input

ORIGINAL
Hello   World
CHANGED
hello world

Expected output

--- Original
+++ Changed
 Hello   World

With both options on, the lines compare as equal and the tool reports the texts as identical. The diff keeps the original text unchanged; the options only change what counts as a difference.

Limits and checks before you use the result

  • This is a line-based text diff. Reordered JSON keys or reformatted code can show as changes even when the meaning is the same; format both sides first.
  • The on-screen table shows the first 800 rows. Download the unified diff to review longer results in full.
  • Turn ignore options off when auditing code, YAML or legal text, where case and whitespace changes can matter.

Frequently asked questions

How do I compare two texts online?

Paste the original on the left and the changed version on the right. Differences appear immediately, side by side or as a unified diff, with counts of added, removed, changed and unchanged lines.

What counts as a changed line?

When a removed line and an added line line up, they are shown as one changed row with the differing words highlighted, rather than as two unrelated edits.

Can I find the difference between two strings?

Yes. Paste each string into one side. Two different single-line strings show as one changed row, and the side-by-side view highlights the words that differ unless almost every word changed.

Can it handle large files?

Yes. The comparison uses an algorithm whose cost scales with the number of differences, so two nearly identical files of several thousand lines compare in milliseconds.

Is my text uploaded anywhere?

No. The comparison runs entirely in your browser, which is what makes it safe to paste a contract, a config file or production logs into it.

Guides

Related tools