Compare two texts and highlight the differences line by line
This diff checker implements the Longest Common Subsequence (LCS) algorithm via dynamic programming. It builds an (m+1)×(n+1) matrix where m and n are line counts, then backtraces to classify each line as added, deleted, or unchanged. The LCS approach produces minimal, optimal diffs — the fewest number of changes needed to transform one text into the other. This is the same fundamental algorithm used by git diff, though simplified to line-level granularity without inline word highlighting.
Real-world use cases:
This tool is part of the FAK LAB ecosystem, founded by Faizan Ahmad Khan Khichi. Text comparison runs entirely in your browser's memory. Your code, documents, and configurations — which may contain secrets, proprietary logic, or sensitive data — are never transmitted to any server. The LCS algorithm executes locally using JavaScript arrays. No text is cached, logged, or accessible to anyone.
It uses Longest Common Subsequence (LCS) via dynamic programming — an O(m×n) algorithm where m and n are line counts. This finds the longest sequence of lines common to both texts, then classifies remaining lines as additions or deletions. It produces optimal (minimal) diffs but may use significant memory for very large files (10,000+ lines).
No. This is a text-based line-by-line comparator. It works with source code, prose, CSV, JSON, XML, configuration files, and any UTF-8 text. For binary or image comparison, specialized tools that perform byte-level or pixel-level analysis are required.
It trims leading and trailing whitespace from each line before comparison. This means indentation changes, trailing spaces, and mixed tabs/spaces won't show as differences. The content itself must still match — only surrounding whitespace is ignored. This is particularly useful when comparing code that has been reformatted.