Diff Checker — Compare Text Side by Side
Paste your original and modified text below to instantly see a colour-coded, line-by-line breakdown of every change. Additions are highlighted in green, removals in red, and unchanged lines stay white. Everything runs locally in your browser — your text is never sent anywhere.
Try These Examples
JavaScript function— See how a function signature and body change between versionsParagraph rewrite— Compare two drafts of the same paragraph with wording editsJSON config— Spot added, removed, and changed keys in a configuration object
How It Works
This tool splits both inputs into individual lines and applies a Longest Common Subsequence (LCS) algorithm to determine which lines are shared between the two texts. The LCS algorithm builds a two-dimensional matrix that tracks the longest matching sequence at every pair of positions, then back-traces through the matrix to reconstruct the optimal alignment.
Once the common lines are identified, the remaining lines in the original text are classified as removals, and the remaining lines in the modified text are classified as additions. The result is a unified, colour-coded view that makes it easy to see exactly what changed.
Line-by-Line Comparison
Each line is compared as a whole unit. If two lines differ by even a single character, the entire line is marked as removed from the original and added in the modified version. This is the same granularity used by tools like git diff and the Unix diff command.
Whitespace and Case Options
When you enable Ignore whitespace, the algorithm normalises all whitespace (leading, trailing, and consecutive internal spaces) before comparing, so formatting-only changes are hidden. Similarly, Ignore case converts both texts to lowercase before comparison, letting you focus on structural changes rather than capitalisation differences.
Frequently Asked Questions
What algorithm does this diff checker use?
This tool uses a Longest Common Subsequence (LCS) algorithm to compare lines. LCS finds the longest sequence of lines that appear in both texts in the same order, then marks everything else as an addition or removal. This is the same fundamental approach used by git diff and the classic Unix diff utility.
Is my text sent to a server?
No. This diff checker runs entirely in your browser using JavaScript. Your text never leaves your device — there are no API calls, no server processing, and no data storage. You can verify this by checking the Network tab in your browser's developer tools.
What does the ignore whitespace option do?
When "Ignore whitespace" is enabled, the diff algorithm treats lines that differ only in leading, trailing, or internal spacing as identical. This is useful when comparing code that has been reformatted or re-indented, so you can focus on meaningful content changes rather than formatting differences.
Can I compare large files with this tool?
Yes. Since the tool runs locally in your browser, there are no upload size limits. However, extremely large files (tens of thousands of lines) may take a moment to process depending on your device's performance. For best results with very large files, close other browser tabs to free up memory.