Skip to main content
AllDevToolsHub
โš–๏ธ

Text Diff Checker

100% Local

Compare two texts and highlight the differences.

Text Diff Checker
0 chars
0 chars

Line-by-Line Comparison

Paste any two blocks of text to see additions, deletions, and unchanged lines. Toggle whitespace and case sensitivity for flexible comparison. All processing happens in your browser.

Try:
This tool runs entirely in your browser. Your input is never uploaded, logged, or sent to AllDevToolsHub or anyone else, and it keeps working offline once the page has loaded.

Paste two versions of text. Differences highlight word-by-word with additions and deletions marked.

Overview

What is Text Diff Checker?

Paste two blocks of text and instantly see what changed line by line. Highlights additions, deletions, and modifications. Perfect for comparing code or configs.
FAQ

Frequently Asked Questions

Reference

Technical Deep Dive

DEVELOPMENT TOOLS

Text Diff Checker

Paste two blocks of text and instantly see what changed between them. Highlights additions, deletions, and modifications line by line. Perfect for comparing code revisions, configuration files, or any text content where you need to spot differences quickly.

๐Ÿ”

Character & word level

Switch between line, word, and character granularity. Whitespace-only and case-only changes can be folded so real edits stand out.

๐Ÿ”’

Nothing is uploaded

Both texts are diffed with a Myers algorithm running in the tab. Paste a contract, a config, or a prod log โ€” it never leaves the browser.

๐Ÿ“‹

Copyable output

Export the result as a unified diff or side-by-side HTML you can drop into a PR comment or a review doc.

Text Diff: The Oldest Engineering Tool Still in Daily Use

Diff was invented in 1974 (Doug McIlroy at Bell Labs). Five decades later, every code review, every git commit, every configuration audit, and every contract revision still runs through it. This tool brings the diff experience to ad-hoc text comparison, paste two versions, see what changed, decide if the change is right.

The Three Granularities of Diff

Line diff is the default and what you usually want.

  • Treats each line as an atomic unit.
  • Adds/removes/keeps whole lines.
  • Best for code (lines = statements), configs (lines = settings), CSV data (lines = records).

Word diff is for prose changes.

  • Within each line, highlights which words changed.
  • Useful for editorial review of an article, contract redlines, blog post versions.
  • A reformatted paragraph with one word changed shows that one word, not the whole paragraph.

Character diff is the finest granularity.

  • Each character is a unit.
  • Useful for: 'I changed one digit in this number, where is it?' or 'is this a different email or just visually similar?'.
  • Noisy for prose-level changes (every changed word becomes a sea of red and green characters).

This tool lets you switch between all three on the same paste.

How Diff Algorithms Work (Briefly)

The classic diff algorithm finds the longest common subsequence (LCS) between two sequences. Everything in the LCS is unchanged; everything outside it is an addition or deletion.

The naive LCS algorithm is O(nยฒ), slow for large inputs. Modern diff implementations use:

  • Myers algorithm (1986), O(nร—d) where d is the size of the diff. Much faster when the inputs are mostly similar.
  • Histogram diff (Git's default), Even better for code, where lines repeat predictably.
  • Patience diff, Optimized for diffs with large rearrangements.

This tool uses Myers algorithm for line/word/character diffs. For typical text (mostly unchanged with localized edits), performance is near-instant up to ~100,000 lines.

Side-by-Side vs. Unified

Two views of the same diff:

Side-by-side:

Better for: visual scanning, small changes, comparing one screen of text.

Unified:

Better for: sharing in code reviews, pasting into commit messages, automation that parses diff output. Lines starting with - are deleted; + are added; space-prefixed are context (unchanged). This is the format git outputs.

Whitespace and Formatting Differences

A common annoyance: two files are semantically identical but formatted differently. Indentation changed, trailing whitespace added, line endings differ (CRLF vs LF). The 'ignore whitespace' option treats these as equal:

  • Ignore all whitespace: lines that differ only in whitespace are considered identical.
  • Ignore leading whitespace: indentation changes ignored.
  • Ignore trailing whitespace: trailing spaces ignored.
  • Ignore EOL differences: \r\n vs \n treated as equal.

For comparing code where one version was run through Prettier, 'ignore whitespace' is the right setting. For comparing JSON where formatting matters less than content, it's also useful.

Use Cases Beyond Code

  • Contract revisions. Original and proposed redline; spot every change in legal text.
  • Email drafts. Compare a sent email to a follow-up draft to see what you changed.
  • Configuration audits. Compare prod and staging configs to spot drift.
  • Translation review. Original and translated text side-by-side (word diff helps spot rephrasing).
  • Document edits. Compare two versions of a Word doc exported to plain text.
  • API response comparison. Compare two API responses to find what changed between calls.
  • Log analysis. Compare two log excerpts to spot new error patterns.

Limitations and Edge Cases

  • Reordered content. Diff doesn't handle 'these two paragraphs were swapped' well, it shows both as deletions+additions. Algorithms exist for this (XML-aware diffs, JSON diffs) but are specialized.
  • Binary content. Diff is for text. For binary (images, PDFs), use a binary-aware comparison tool.
  • Very long lines. A single 50,000-character line is treated as one line by line-diff. If that line changed in 10 places, line diff shows the whole line; word diff is more useful.
  • Encoding differences. Two files that look the same but use different Unicode normalizations may show as different. This tool normalizes to NFC before comparing.

Patch Output

Some diff workflows want to produce a 'patch' file, a unified diff that can be applied with patch or git apply to transform original into modified. This tool's unified view is in standard patch format; copy it, save as .patch, apply with:

This isn't the typical use case for a browser-based diff (you have git for that), but it's possible.

Common Workflows

  1. Pre-commit review. Compare your in-progress changes against the last clean version to make sure nothing accidentally crept in.
  2. Vendor comparison. Compare a contract before and after vendor edits.
  3. AI-generated content review. Compare a draft to AI-revised version to see all the edits.
  4. Configuration drift. Diff a known-good config against the current live config.
  5. Spec compliance. Diff your implementation's output against the expected spec output.
  6. Translation QA. Diff two translations of the same source.

Privacy

Both inputs and the computed diff stay in your browser. The diff algorithm runs in JavaScript, the highlighting in HTML/CSS. No outbound requests. Suitable for comparing proprietary code, sensitive contracts, internal configs.

03 Diffing Outside of Git

Most engineers' diff muscle memory is git diff on a working tree. Plenty of real comparisons happen on text that is not in a repo, pasted snippets, API responses, contract revisions, configs scraped from two production hosts. This is where a browser diff earns its place.

  • ๐Ÿ“ฅ
    PR review when you only have two file versions Someone shares "before" and "after" of a file in chat. You need to see the change without cloning, branching, or staging. Paste both, get a unified diff in seconds.
  • ๐ŸŒ
    API response snapshots Call the same endpoint twice, once on staging, once on prod, and diff the JSON to spot environment drift, missing fields, or schema changes the team forgot to document.
  • ๐Ÿ“œ
    Contract and terms-of-service diff Legal docs change in subtle ways. A vendor sends a "minor" revision of an MSA, paste old and new and see every clause that moved. Word-grain diff is the right setting here.
  • โš™๏ธ
    Config drift between two servers SSH into two hosts, cat /etc/nginx/nginx.conf on each, paste both. Find the directive that explains why traffic only routes correctly on one of them.
  • ๐Ÿ“ง
    Email and document edits Compare a sent email to a follow-up draft, or two exported versions of the same Word doc, when track-changes was off.

04 Worked Examples

EXAMPLE 1 ยท GRANULARITY: LINE VS WORD VS CHAR
Same change, three views:
Before: The quick brown fox jumps over the lazy dog.

After: The quick brown fox leaps over the sleepy dog.


How each grain reports it:

Line:  whole line shown as deleted + whole line added
Word: - jumps + leaps, - lazy + sleepy (clean)
Char: - jum + lea, - ps + ps, ... (noisy)

Line-grain is the right default for code and configs (line = statement). Word-grain is right for prose. Char-grain is right when you suspect a single typo and need to find which character changed.




EXAMPLE 2 ยท UNIFIED FORMAT HEADERS

Unified diff hunk:

@@ -1,5 +1,5 @@
function greet(name) {

  • return "Hello, " + name;
  • return Hello, ${name};
    }

How to read the header:

@@ -1,5 +1,5 @@
-1,5 โ†’ original: 5 lines starting at line 1
+1,5 โ†’ modified: 5 lines starting at line 1

This is the format diff -u emits and what GitHub renders. The hunk header tells you where in each file the slice lives; this matters when a long file has multiple distant changes.




EXAMPLE 3 ยท "DIFF SAYS IDENTICAL BUT FILES ARE DIFFERENT"

Common culprits:

1. Line endings: CRLF (Windows) vs LF (Unix)

  1. Trailing whitespace on otherwise-identical lines
  2. BOM (\uFEFF) at the start of one file
  3. Unicode normalization: รฉ as U+00E9 vs e + U+0301

How to spot them:

diff -u  โ†’ may show nothing

xxd a | diff - <(xxd b) โ†’ reveals byte-level differences
cat -A file.txt โ†’ shows ^M (CR), $ (LF), tabs as ^I


If a build hashes identically on one machine and not another, suspect line endings or BOM before suspecting your tooling. This tool normalizes to NFC and offers an "ignore line endings" toggle to surface or hide these.




05 Related Tools

After diffing, you often need to act on the difference, transform, sort, or measure. These pair well.

You Might Also Need