~welcome
diff-checker

Diff Checker

Compare text with line-level and character-level highlighting

$ how-to-use

Paste the original text on the left and the modified text on the right. Differences are highlighted instantly — green for additions, red for deletions. Toggle between inline and side-by-side views.

Why Use a Diff Checker?

Comparing two versions of text manually is slow and error-prone — especially with large documents, code files, or configuration changes. A diff checker highlights exactly what changed, what was added, and what was removed, line by line.

Developers use diffs constantly: reviewing pull requests, debugging config changes, comparing API responses, and verifying deployment differences. Writers use them to track document revisions. System admins compare config files across environments.

View Modes

Side by Side

Shows original and modified text in two columns. Best for comparing files with many changes — easy to scan left-right.

Inline

Shows changes in a single column with additions and deletions interleaved. Similar to git diff output. Best for small, focused changes.

Character-Level Diff

Highlights individual character changes within lines, not just whole-line differences. Crucial for spotting typos and small edits.

Ignore Whitespace

Skip formatting-only changes like indentation and trailing spaces. Focus on actual content differences.

Common Use Cases for Diff Checking

Code Review Without Git

Not all code changes go through pull requests. Sometimes you're comparing snippets from Stack Overflow, reviewing a colleague's suggestion in Slack, or checking what a code generator changed. Paste both versions and see exactly what's different — no repository required. The character-level diff mode is especially useful for catching subtle changes like a semicolon becoming a comma.

Config File Comparison

Comparing configuration files across environments (dev, staging, production) is a critical DevOps task. A mismatched database URL, an extra feature flag, or a missing environment variable can cause production incidents. Paste your staging config and production config side by side to find every difference before deploying. Use the "Ignore Whitespace" mode to skip formatting-only changes.

API Response Debugging

When an API starts returning unexpected data, compare the current response against a known good response. This instantly shows which fields changed, what was added, and what was removed. For JSON responses, format them first with the JSON formatter, then paste both versions here for a clean structural diff.

Document Revision Tracking

Writers, editors, and legal teams use diff tools to track changes in contracts, documentation, and policies. The inline view mode shows additions and deletions interleaved, similar to "track changes" in word processors. For legal documents, character-level diff ensures no single word or comma change goes unnoticed.

Database Migration Verification

Before and after running database migrations, dump the schema and compare. This confirms that the migration did exactly what you expected — added the right columns, changed the right types, dropped the right indexes — and nothing else. It's a safety net that catches migration scripts with unintended side effects.

How Diff Algorithms Work

The diff algorithm at the core of this tool (and tools like Git) is based on finding the Longest Common Subsequence (LCS) between two texts. The LCS is the longest sequence of lines that appear in both texts in the same order, though not necessarily consecutively. Lines not in the LCS are either additions (in the new text but not the old) or deletions (in the old text but not the new).

The classic algorithm for this is the Myers diff algorithm, published by Eugene Myers in 1986. It runs in O(N*D) time, where N is the total number of lines and D is the size of the minimum edit script (the number of changes). This means it's fast when changes are small relative to file size — exactly the common case for code changes.

Character-level diffing applies the same algorithm at a finer granularity. Instead of comparing lines, it compares individual characters within changed lines. This is computationally more expensive but essential for spotting the exact position of changes within a line — like a changed variable name or a swapped operator.

The "Ignore Whitespace" mode works by normalizing whitespace before comparison. Leading/trailing whitespace is stripped, and consecutive spaces are collapsed. This is useful for code where indentation changed (e.g., after reformatting) but the logic is the same.

FAQ

How large can the text inputs be?

The diff runs in your browser, so it depends on your device. Typical modern browsers handle texts up to several megabytes comfortably. For very large files, performance may vary.

What diff algorithm is used?

The tool uses a standard line-by-line diff algorithm similar to what Git uses. It finds the longest common subsequence and highlights additions and deletions relative to that.

Is my data private?

Yes. All comparison happens in your browser. No text is sent to any server. Safe for comparing sensitive code, configs, and documents.