DevNb

Text & Strings/Text Diff Checker

Text Diff Checker

Compare two text blocks or source files. Spot deletions, additions, and intra-line word edits with zero server upload.

Original Text
Modified Text
Diff Output+6 additions-9 deletions1 unchanged
1function calculateTotal(items, taxRate) {1function calculateTotal(items, taxRate = 0) {
2 var total = 0;2 // Use modern reduce syntax
3 for (var i = 0; i < items.length; i++) {3 const subtotal = items.reduce((sum, item) => sum + item.price, 0);
4 total = total + items[i].price;4 const tax = subtotal * taxRate;
5 }5 const grandTotal = subtotal + tax;
6 if (taxRate > 0) {6 return Number(grandTotal.toFixed(2));
7 total = total + (total * taxRate);
8 }
9 return total;
10}7}

How the diff algorithm works

This tool runs a Longest Common Subsequence (LCS) comparison directly inside your browser. It identifies unchanged lines, deleted lines, and newly inserted lines. When a line is modified, intra-line word diffing pinpoints the exact characters or words that changed.

You can toggle between Side-by-Side (split dual-column view) and Unified (single stream view with + and - markers), as well as ignore whitespace and case variations.

FAQ

Is my source code or confidential text private?

Yes, 100%. The diff algorithm executes entirely inside your browser's JavaScript engine. No content is ever sent to a server, logged to an API, or shared.

Can I download a patch file?

Yes. Click the Download .patch button to save a standard Git-compatible unified patch file that can be applied with git apply.

Need to sort, deduplicate, or clean lines before diffing? Try Sort & Dedupe Lines →