Text Diff

Paste two texts and instantly see every line that was added, removed, or unchanged — like a git diff in your browser.

How Text Diff Works

The tool splits each input into lines and runs an LCS (longest-common-subsequence) algorithm — the same algorithm used by git diff — to find the minimum set of edits that transforms Text A into Text B.

Line numbers are shown for both sides so you can navigate directly to the change in your editor. The Ignore case toggle normalises both sides to lowercase before comparison, so Hello and hello count as equal. The Ignore whitespace toggle trims leading and trailing spaces from each line before comparing — useful for config files where indentation varies between environments.

Works on any plain text: source code, JSON, YAML, SQL queries, log files, config files, Markdown, CSV, or plain prose. For structured JSON comparison with key-by-key analysis that ignores key ordering, use the JSON Diff tool instead.

When to Use Text Diff

Any time you have two versions of the same file and need to know exactly what changed:

Text Diff vs JSON Diff — Which Should You Use?

Feature Text Diff JSON Diff
Input typeAny plain textValid JSON only
Comparison methodLine-by-line LCSRecursive key-by-key
Handles key reorderingNo — shows as changeYes — order-independent
Nested path displayNoYes (e.g. user.address.city)
Ignore whitespace optionYesN/A (parsed before compare)
Best forCode, configs, logs, MarkdownAPI responses, JSON data

Frequently Asked Questions

How does the text diff tool work?

It splits both texts into lines and runs an LCS diff — the same algorithm behind git diff. Lines only in B are green (added); lines only in A are red (removed); shared lines are white (unchanged).

Is my text sent to a server?

No. Everything runs in your browser with JavaScript. Your text never leaves your device.

What kinds of text can I compare?

Any plain text: source code, JSON, YAML, Markdown, config files, SQL queries, log output, CSV, or prose. The tool is completely language-agnostic.

Does it ignore whitespace or case?

By default, comparison is exact. Use the Ignore case and Ignore leading/trailing whitespace checkboxes to relax those constraints.

What is the difference between Text Diff and JSON Diff?

JSON Diff is structure-aware: it parses both inputs as JSON and compares objects key-by-key, so reordered keys don't produce false positives. Text Diff is line-based and works on any text, but treats input as plain characters — not structured data.

Is there a character or line limit?

There is no hard limit. Very large files (tens of thousands of lines) may take a moment to compare, since LCS runs in the browser.

Can I diff JSON files with Text Diff?

Yes — JSON is plain text, so Text Diff works on it. However if the same data is formatted differently (different indentation, reordered keys) Text Diff will show many false-positive changes. For JSON-specific comparison, use JSON Diff which parses the structure before comparing.

Why does swapping A and B show the same number of changes?

By design — a diff is symmetric. Lines added going from A→B become lines removed going from B→A, and vice versa. The totals stay the same; only the green/red colouring is mirrored.