FAK LAB Diff Checker
🔀

Diff Checker

Compare two texts and highlight the differences line by line

How to Use the Diff Checker

  1. Paste Texts: Enter the original text in the left panel and the modified version in the right panel. These can be code, configuration files, documents, or any plain text.
  2. Configure Options: Check "Ignore Case" to treat uppercase and lowercase as identical. Check "Ignore Whitespace" to disregard leading/trailing spaces and indentation differences.
  3. Compare: Click "Compare" to run the diff algorithm. Results appear below with green highlighting for added lines (+) and red for removed lines (−).
  4. Swap: Click "Swap" to exchange the two panels — useful when you want to reverse the comparison direction.
  5. Statistics: The summary bar shows counts of added lines, removed lines, and unchanged lines for a quick overview of change magnitude.

Technical Overview & Use Cases

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:

Privacy & Security Guarantee

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.

Frequently Asked Questions

What algorithm does the diff use?

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).

Can it compare binary files or images?

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.

What does "Ignore Whitespace" actually ignore?

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.