UtilitySansar
Text

Text Diff

Paste two versions of a text and see exactly what changed — added lines in green, removed lines in red, and the changed words inside each line highlighted. Switch between unified and side-by-side views, ignore case or whitespace noise, and export a real .diff patch.

  • Published
  • Last reviewed

Tool Summary Answer Block

This tool accepts structured input and returns deterministic output in the browser with no server upload.

Tool name
Text Diff
Input intent
Provide source content to transform, validate, or analyze.
Output intent
Receive normalized output suitable for copy, reuse, or debugging.
Example input
The quick brown fox jumps over the lazy dog
Example output
- jumps over the lazy dog + leaps over the sleepy dog
+1 additions−1 deletions1 unchanged50%similar
11The quick brown fox
2jumps over the lazy dog
2leaps over the sleepy dog

Tool Introduction

Paste two versions of a text and see exactly what changed — added lines in green, removed lines in red, and the changed words inside each line highlighted. Switch between unified and side-by-side views, ignore case or whitespace noise, and export a real .diff patch.

Tool Overview

The Text Diff tool computes the longest common subsequence between the two inputs to produce a minimal, readable line diff, then runs a second word-level pass over each changed line so you can spot the exact words that differ instead of rescanning whole lines. A similarity score tells you at a glance how close the two versions are. The ignore-case and ignore-whitespace options filter out changes you don't care about — capitalization edits, re-indented code, or collapsed spacing — while still displaying the original text. Output comes in two flavors: a quick unified listing for pasting into chat or a code review, and a standards-compliant unified diff (with ---/+++ headers and @@ hunks) that git apply and patch understand, downloadable as a .diff file. Everything runs client-side in your browser; neither text is ever uploaded.

Use Cases

  • Review edits between two drafts of an article, contract, or email before publishing
  • Compare configuration files or environment settings across two deployments
  • Check what a colleague (or an AI assistant) actually changed in a rewritten paragraph or code snippet
  • Verify that a copy-paste between systems didn't silently alter whitespace or wording
  • Generate a .diff patch from two file versions when you don't have git at hand

Input/Output Examples

Line-level diff with the changed words (jumps→leaps, lazy→sleepy) highlighted inside each line.
Input Intent
The quick brown fox
jumps over the lazy dog
Output Intent
- jumps over the lazy dog
+ leaps over the sleepy dog
The ignore options treat capitalization and spacing differences as equal.
Input Intent
Hello World  vs  hello   world (ignore case + whitespace on)
Output Intent
0 additions, 0 deletions — texts are identical
Download .diff produces a standard unified patch with @@ hunks that git apply understands.
Input Intent
Two versions of a config file
Output Intent
--- original
+++ changed
@@ -3,7 +3,7 @@
-timeout = 30
+timeout = 60

FAQ

Is this a character-level or line-level diff?+
Both. Lines are compared first using the longest common subsequence algorithm, then each changed line is paired with its counterpart and diffed word-by-word, so the exact edited words are highlighted inside the line.
What do the Ignore case and Ignore whitespace options do?+
They change how lines are compared, not how they are displayed. Ignore case treats "Hello" and "hello" as the same line; Ignore whitespace trims leading/trailing spaces and collapses runs of spaces or tabs, which is handy for re-indented code.
How is the similarity percentage calculated?+
It is the share of lines common to both texts: 2 × unchanged lines divided by the total line count of both versions. Identical texts score 100%, completely different texts score 0%.
Can I apply the downloaded .diff file with git or patch?+
Yes. The Download .diff button produces a standard unified diff with ---/+++ headers and @@ hunk markers, so tools like git apply, patch -p0, and most code editors can consume it.
What is the difference between Unified and Split view?+
Unified view interleaves removals and additions in one column, like a git diff. Split view shows the original on the left and the changed text on the right with matching lines aligned — easier for reviewing prose.
Can I use it on code or large files?+
Yes. Whitespace and special characters are preserved, you can drag text files straight onto either input, and the diff engine trims the unchanged head and tail of both texts first so even long files with few edits compare quickly.
Is my text uploaded anywhere?+
No. The comparison happens entirely in your browser — neither text leaves your device, which makes the tool safe for contracts, credentials, and other sensitive content.

Explore More Tools

Discover related utilities in the Text category below.

Browse all Text

Related tools

Handpicked utilities you might find useful