SpeedDrain
Split & Unified Views · Line Highlighting · Private

Text Diff & Comparison Checker

Compare two text blocks, scripts, or markdown drafts side by side. Instantly spot added lines, removed text, and formatting changes.

Comparison Output
+4 additions-6 deletions1 unchanged
1-function calculateTotal(items) {
2- let total = 0;
3- for (let i = 0; i < items.length; i++) {
4- total += items[i].price;
5- }
6- return total;
7 }
1+function calculateTotal(items, discountRate = 0) {
2+ const subtotal = items.reduce((acc, item) => acc + item.price, 0);
3+ const discount = subtotal * discountRate;
4+ return Math.max(0, subtotal - discount);
5 }

How Text Difference Algorithms Work

The Longest Common Subsequence (LCS) Principle

Under the hood, diff utilities utilize the Longest Common Subsequence (LCS) mathematical approach, similar to the Myers algorithm in Git. The engine calculates the shortest sequence of edits (insertions and deletions) required to transform the original file into the target file.

Green lines indicate items added in the modified document, while red lines represent elements deleted from the original document. Lines that remain unchanged provide visual anchoring context.