Text Diff
Compare text at line, word, or character level with unified diff output.
Recommended tools
Free CDN, DNS, and edge hosting for developers.
Affordable domains and SSL certificates.
Affiliate links — we may earn a commission if you sign up.
About the Text Diff
The Text Diff tool compares two blocks of text at three granularities — line, word, and character — using a real LCS (longest common subsequence) algorithm rather than a naive positional compare, so reordered lines still align correctly and only genuine changes are flagged. Text A and Text B sit side by side with live line counts, and a tab strip switches between Line diff, Word diff, and Character diff views. The visual pane color-codes everything: added content in green, removed content in red with strikethrough in word and character modes, unchanged text in gray, with per-line + / - prefixes in line mode. Two switches change the comparison semantics — Ignore whitespace collapses all spacing before comparing, and Ignore case lowercases both inputs — and when the texts turn out identical under the current options, an explicit Texts are identical badge appears instead of an empty pane. A Unified diff panel renders standard patch format with @@ hunk headers and three lines of context, downloadable as diff.patch. It is ideal for reviewing prose revisions, comparing config snapshots, or auditing exactly what changed between two versions.
Examples
Text A: The quick brown fox jumps over the lazy dog. A classic pangram for testing. Line four is unchanged. Line five will be removed. Text B: The quick red fox jumps over the sleepy dog. A classic pangram for testing. A brand new line was added here. Line four is unchanged.
--- a +++ b @@ -1,5 +1,5 @@ -The quick brown fox -jumps over the lazy dog. +The quick red fox +jumps over the sleepy dog. A classic pangram for testing. +A brand new line was added here. Line four is unchanged. -Line five will be removed.
Text A: cat Text B: cut (Character diff mode)
--- a +++ b c -a +u t
Text A: SELECT id FROM users Text B: select id from users (Ignore case on)
--- a +++ b
How to use
- 1
Paste the original into Text A (original) and the changed version into Text B (modified).
- 2
Pick a granularity with the tabs: Line diff, Word diff, or Character diff.
- 3
Toggle Ignore whitespace and Ignore case to tune what counts as a difference.
- 4
Read the visual pane — green added, red removed, gray unchanged.
- 5
Copy or download the Unified diff (diff.patch) for use with patch tooling.
Common use cases
- Reviewing prose edits sentence by sentence without missing a moved paragraph.
- Comparing two configuration snapshots to audit exactly which keys changed.
- Spotting a one-character typo inside a long token with Character diff mode.
- Checking that a formatter only changed whitespace by enabling Ignore whitespace.
- Reviewing translations where word-level changes matter more than whole lines.
- Generating a patch-style report of changes for a release note.
Best practices
- Choose line mode for documents, word mode for sentence-level edits, and character mode for typos inside words.
- Enable Ignore whitespace before comparing code that has been auto-formatted — indentation noise hides real edits.
- Use Ignore case when comparing case-insensitive formats like SQL keywords or config keys.
- Trust the stats (Added / Removed / Unchanged) for a quick summary before reading the visual diff.
- Remember word and character modes emit a single-stream unified view, while line mode produces @@ hunks with context.
- Load the sample first to learn the color coding, then paste your own texts.
Tips
- Use Character diff mode when a test failure message differs by one byte — it finds the needle instantly.
- Turn on Ignore whitespace before comparing JSON or code that different tools have pretty-printed.
- Watch for the Texts are identical badge instead of scanning empty panes after relaxing both switches.
- Download diff.patch for records — it includes hunk context that a screenshot cannot capture.
Frequently asked questions
Explore more developer tools
Browse the full collection of developer tools on the hub, or jump back to all categories.