Text Diff (Compare Text & Code)

Enter text or code into A (left) and B (right) to compare added/removed/changed lines, side by side or as a git-style Unified Diff. Nothing is sent to a server — everything runs in your browser.

A (original)
B (changed)

🔗 Share link gzip-compresses the A/B text and encodes it directly into the link itself (after the # in the address bar). It's never sent to a server, but anyone with the link can read its contents — don't share sensitive data this way.

How to use

  1. Input: Paste text or code into A (original) and B (changed), or open/drag a file into each.
  2. Options: Turn on "Ignore whitespace" to skip indentation-only differences, "Ignore case" to skip case-only differences, or "Character-level highlight" to compare changed lines character by character instead of word by word.
  3. Check the result: "Side by side" lines up both versions in two columns, highlighting only the words that actually changed within a modified line. "Unified Diff" shows a git-style patch with @@ -a,n +b,n @@ hunk headers.
  4. Share/export: Use "🔗 Share link" to share the comparison as one link, or copy/download the Unified Diff as a .diff file.

Everything runs inside your browser (JavaScript) — nothing you enter is sent to a server or stored.

When would you use Text Diff?

Useful for a quick comparison before a code review, checking how a config file changed across a deployment, or reviewing the difference between two versions of a document. It's especially handy when git isn't installed, or when comparing two blobs of text that don't belong to any git repository at all.

Frequently Asked Questions

Is my text sent anywhere?

No. The comparison runs entirely in JavaScript inside your browser and is never sent to a server.

Is this a line-level or character-level comparison?

Line-level by default. Any line pair classified as "changed" is then re-compared word by word, so only the words that actually differ get highlighted. Turn on "Character-level highlight" to compare those lines character by character instead — useful for catching a single changed letter inside a longer word, a typo, or languages that don't separate words with spaces.

What do the numbers in @@ -3,6 +3,7 @@ mean?

-3,6 means "6 lines starting at line 3 of A (original)"; +3,7 means "7 lines starting at line 3 of B (changed)" are included in this hunk. It's the same format git diff and diff -u produce, so you can use it directly as a patch file.

What exactly does "Ignore whitespace" ignore?

It trims leading/trailing whitespace from each line and collapses runs of spaces/tabs within a line down to one, before comparing. Useful when comparing code that differs only in indentation style.

Can it handle very long texts?

It works within your browser's memory limits, but comparison and side-by-side rendering can get slow once you're past tens of thousands of lines. Unified Diff view is lighter in that case.

Should I use this for comparing JSON?

Use the JSON Diff tool instead. It treats objects with reordered keys as identical and shows changes in a structured tree, which suits JSON better than a line-based text diff.