Diff Checker
Compare two texts and find differences with side-by-side or unified view
What Is a Diff Checker?
A diff checker compares two blocks of text and highlights exactly what changed between them — which lines were added, removed, or modified. It's the same concept behind git diff, code review tools, and document comparison features in editors like VS Code.
This tool goes beyond basic line-level comparison. It pairs changed lines and computes character-level diffs, showing you precisely which characters within a line were modified. Combined with side-by-side and unified views, line numbers, and diff statistics, it gives you a complete picture of what changed — all running locally in your browser with zero data sent to any server.
How to Compare Two Texts
- Paste your original text — Put the "before" version in the left textarea.
- Paste your modified text — Put the "after" version in the right textarea.
- View the diff — Differences appear automatically. Toggle between side-by-side and unified views.
- Fine-tune with options — Enable "Ignore whitespace" to skip spacing changes, or "Ignore case" to treat uppercase and lowercase as equal.
- Copy the diff — Click "Copy Diff" to get a unified diff format you can paste into Git, code reviews, or documentation.
Side-by-Side vs Unified View
The side-by-side view shows the original and modified text in two columns, making it easy to scan corresponding lines. Removed lines appear on the left in red, added lines on the right in green, and matching lines align across both columns. This is the most intuitive view for reviewing changes.
The unified view shows all changes in a single column with + and − prefixes, similar to the output of git diff. It's more compact and works better when you need to copy the diff output or when viewing on narrow screens.
Both views include character-level highlighting within changed lines, so you can see exactly which words or characters were modified — not just that a line changed.
How the Diff Algorithm Works
This tool uses an LCS (Longest Common Subsequence) based diff algorithm, similar in principle to the Myers diff algorithm used by Git. The algorithm works in two stages:
- Line-level diff: Computes the LCS of the two texts at the line level to determine which lines are unchanged, added, or removed.
- Character-level diff: For paired changed lines (a removed line followed by an added line), computes a second LCS at the character level to highlight exactly which characters changed.
The LCS approach guarantees the minimal edit distance — it finds the smallest set of changes needed to transform one text into the other. This means you'll never see unnecessary or misleading "changes" in the output.
Common Use Cases
- Code review — Compare two versions of a function, configuration file, or entire source file to see what changed.
- Document comparison — Find differences between two drafts of a document, email, or legal text.
- Configuration auditing — Compare production vs. staging configs, old vs. new nginx configs, or .env file versions.
- Debugging — Compare expected output vs. actual output to pinpoint test failures.
- API response comparison — Diff JSON/XML responses from different environments or API versions.
- Content migration — Verify that content transferred correctly between CMSes or databases.
- Merge conflict resolution — Paste both versions to understand what each side changed before resolving conflicts.
Frequently Asked Questions
🔒 This tool runs entirely in your browser. No data is sent to any server.