- What a diff checker is and how it works
- How LCS, Myers, and Patience algorithms compare
- When to use line-level vs word-level diff
- How to compare JSON, code, and contracts
- Privacy: why browser-based diff is safer than server-based tools
- Quick Start Guide
- What Is a Diff Checker
- How Diff Algorithms Work
- Line vs Word Level
- Side-by-Side vs Unified View
- Step-by-Step: How to Use
- Ignore Options Explained
- Color Coding Explained
- Comparing JSON & Structured Data
- Unified Diff Format
- Privacy & Security
- Real-World Use Cases
- Diff Checker vs Git Diff
- FAQ (10 Questions)
Quick Start: Compare Texts in 30 Seconds
Paste Your Texts
Original text on the left, modified text on the right. You can also upload text files (.txt, .js, .py, .json, and 20+ more).
Set Options
Toggle ignore whitespace, ignore case, or word-by-word mode based on your needs.
Compare
Click Compare. Every addition, deletion, and modification is highlighted instantly.
Copy Results
Click Copy Diff to grab the results. Paste into PR comments, emails, or documentation.
What Is a Diff Checker
A diff checker compares two blocks of text and highlights every difference — additions, deletions, and modifications — so you can see exactly what changed.
Instead of reading two documents side by side and trying to spot what changed, the tool does it instantly. Paste the original text on the left and the modified text on the right, click one button, and every difference is highlighted in color. No more squinting at paragraphs to find what changed.
Diff checkers are used by developers for code review, writers and editors for draft comparison, legal teams for contract redlining, DevOps engineers for configuration file auditing, and translators for verifying changes. The concept comes from the Unix diff command, first written in the 1970s.
Side-by-Side Input
Paste original on the left, modified on the right. The tool processes both simultaneously and produces a unified diff output.
Instant Results
The comparison uses JavaScript with no server roundtrip and no waiting. Results appear the moment you click Compare.
Visual Highlighting
Added lines appear in green, removed lines in red with strikethrough, and modified lines in amber. Scan through hundreds of changes in seconds.
100% Private
Everything happens on your device. Your text is never sent to any server, never stored, and never logged. Safe for confidential documents and proprietary code.
Multiple Modes
Choose between line-by-line and word-by-word comparison. Toggle ignore whitespace and ignore case to customize comparison strictness.
File Upload
Upload text files (.txt, .js, .py, .json, and 20+ more) directly instead of copying and pasting. The tool reads the file in your browser without sending it anywhere.
How Diff Algorithms Work
Understanding the algorithms behind diff tools helps you interpret results and choose the right approach.
LCS (Longest Common Subsequence)
The foundation of all diff algorithms. LCS finds the longest sequence of lines that appear in both texts in the same order. Everything outside this common sequence is marked as added or removed. The AFFLIGO diff checker uses LCS for its comparison.
Here is how it works step by step: the algorithm splits both texts into lines, builds a dynamic programming matrix to find matching lines, then backtracks through the matrix to produce the diff. Lines in the LCS are unchanged; lines only in the original are deleted; lines only in the modified version are inserted.
Myers Algorithm
The Myers algorithm (1986) is what git diff and GNU diff use by default. It reframes LCS as a shortest-path problem through an "edit graph" and runs in O(ND) time, where N is the input length and D is the edit distance. For files with few changes (typical in code review), Myers is dramatically faster than basic LCS.
Patience Diff
Patience diff, developed by Bram Cohen, anchors on lines that are unique to each side. This makes it better at matching moved or refactored code blocks that Myers might split into separate add/remove operations. Git supports it via git diff --patience.
| Algorithm | Time Complexity | Best For | Weakness |
|---|---|---|---|
| LCS (basic) | O(m × n) | Small inputs, educational | Slow on large files |
| Myers | O(ND) | General-purpose, code review | Can misalign on repeated lines |
| Patience | O(N log N) | Refactored code, moved blocks | Slightly slower than Myers |
The AFFLIGO diff checker uses LCS, which produces the smallest accurate diff. It respects line order — a line moved from position 3 to position 10 shows as removed from 3 and added at 10, not as "unchanged." This is the same algorithmic family behind git diff and GNU diff.
Line vs Word Level
Granularity determines how precisely the tool highlights changes within your text.
The diff checker offers two levels of comparison: line and word. Understanding when to use each one helps you get the most useful results.
Line-Level (Default)
Compares entire lines. If a line changed at all, the whole line is highlighted. Fast and works well for code, configuration files, and any content where line boundaries are meaningful. This is the mode used by git diff.
Word-Level
Splits changed lines at word boundaries and highlights exactly which words were added or removed. Essential for prose, contracts, and documentation where a single word change matters. Instead of seeing an entire paragraph highlighted, you see the two or three words that actually changed.
| Your Content | Use This | Why |
|---|---|---|
| Source code, configs (JSON, YAML) | Line-level | Line boundaries are meaningful; a changed line = a changed statement |
| Prose, articles, documentation | Word-level | A one-word edit should not repaint the whole paragraph |
| Legal contracts, policy documents | Word-level | You need to see the exact clause that changed, not the whole section |
| Minified code, URLs, CSV rows | Word-level | Word-level highlights changes within long single lines |
| Reformatted code (reindented) | Line + ignore whitespace | Cosmetic noise collapses so real logic changes surface |
Side-by-Side vs Unified View
Two common ways to display diff results, each suited for different purposes.
Side-by-Side
Two columns showing original on the left and modified on the right. Best for human review when you want to see the visual alignment of what replaced what. Most web-based diff tools and code review interfaces use this view.
Unified
Single column with - prefix (red) for removed lines and + prefix (green) for added lines, with 3 lines of context around each change. This is the format used by git diff, GitHub PRs, and patch files. Best for copying into commit messages, bug reports, or code review comments.
The AFFLIGO diff checker shows results in an inline format with color-coded lines. The Copy Diff button copies the +/-/~-marked text for pasting into PR comments, bug reports, or chat — note it is plain marked text, not a git-style patch (no ---/+++/@@ headers), so it cannot be fed to git apply.
Step-by-Step: How to Use the Tool
Paste two texts, set three toggles, read the color-coded result — each stage below.
Enter Your Texts
Paste the original text into the left panel and the modified text into the right panel. You can type directly, paste from clipboard (Ctrl+V / Cmd+V), or upload a .txt file by clicking the upload icon next to each textarea.
Set Comparison Options
Ignore whitespace — collapses multiple spaces and trims leading/trailing spaces. Ignore case — converts all text to lowercase before comparing. Word-by-word — enables word-level diff within changed lines. These options only affect the comparison logic, not your displayed input.
Compare
Click Compare. The results appear instantly: a color-coded diff showing every addition, deletion, and modification, plus a summary bar showing counts for added, removed, and unchanged lines.
Refine Your View
Use Show All / Diffs Only toggle to control what you see. Diffs Only hides unchanged lines, making it easier to focus on what changed in large documents.
Copy or Swap
Click Copy Diff to grab results with + and - prefixes. Use Swap to reverse the comparison direction. Use Clear to reset both panels and start fresh.
Ignore Options Explained
How normalization options change what the diff algorithm sees.
The ignore options change how text is normalized before comparison. They do not modify your original text — they only affect how the diff algorithm processes it.
Ignore Whitespace
When enabled, multiple consecutive spaces are collapsed into a single space and leading/trailing whitespace is trimmed. This prevents re-indentation and formatting changes from showing up as differences. Essential for code reviews where only logic changes matter.
Do not enable ignore whitespace for YAML, Python, or Makefiles where indentation changes meaning. In these languages, whitespace IS significant.
Ignore Case
When enabled, all text is converted to lowercase before comparing. Useful when comparing text that may have inconsistent capitalization but the same underlying content.
Color Coding Explained
What each color means and how to read the diff output at a glance.
Green: Added Lines
Lines highlighted in green exist only in the modified (right) text. They were not present in the original. Prefixed with + in the output.
Red: Removed Lines
Lines highlighted in red exist only in the original (left) text. They were deleted in the modified version. Appear with strikethrough. Prefixed with -.
Amber: Changed Lines
Lines highlighted in amber represent modifications. A line in the original was replaced by a different line. Prefixed with ~. Word mode shows specific changed words within.
No Highlight: Unchanged
Lines with no background are identical in both texts. Prefixed with a space. Only visible in Show All mode. Hidden in Diffs Only mode.
The summary bar below the input panels shows three counts after comparison: +N added, -N removed, and =N unchanged. This gives you a quick overview of how much changed.
Comparing JSON & Structured Data
Plain-text diff can produce false positives on structured data. Here is how to get clean results.
When you compare two JSON objects as plain text, key reordering and indentation differences show up as changes even when the data is equivalent. For example, {"a":1,"b":2} and {"b":2,"a":1} contain the same data but differ as text.
How to Get Clean JSON Diffs
Pretty-Print Both Sides
Format both JSON objects with consistent indentation (2 or 4 spaces). This normalizes formatting so indentation differences do not create noise.
Enable Ignore Whitespace
This collapses any remaining whitespace differences, so only actual value changes appear in the diff.
Use Word-Level Mode
For long JSON lines, word mode highlights exactly which values changed instead of highlighting the entire line.
For advanced JSON comparison where key order is irrelevant, consider normalizing both inputs by sorting keys recursively before diffing. Tip: pretty-print both sides first with our JSON Formatter so only genuine value changes appear.
Unified Diff Format
The standard format for patches, commit messages, and code review.
Unified diff is the canonical text format used by git diff, diff -u, GitHub PRs, and every code review tool. It shows removed lines prefixed with - and added lines prefixed with +, with 3 lines of context around each change.
Click Copy Diff in the AFFLIGO tool to grab the marked-up text. Paste it into a GitHub PR comment, a bug report, or a Slack message for human review. (It is not a machine patch — for patch -p1 workflows, generate the diff with git diff itself.)
Privacy & Security
Why browser-based diff is safer than server-based alternatives.
Many online diff tools process your text on their servers — meaning your confidential content briefly lives on someone else's computer. This can be a problem under GDPR (personal data transfer), HIPAA (protected health information), NDAs (confidential business information), or when comparing proprietary code.
The AFFLIGO diff checker runs entirely in your browser. Your text is compared using JavaScript on your own device. Nothing is sent to any server, nothing is stored, and nothing is logged. You can verify this yourself: open browser DevTools, switch to the Network tab, clear the log, click Compare, and confirm that zero network requests fire.
While the tool is safe for confidential text, always follow your organization's data handling policies. If you are comparing sensitive medical, legal, or financial data, ensure your use complies with applicable regulations.
Real-World Use Cases
Common scenarios where a diff checker saves real time and catches errors.
Code Review
Paste old and new versions of a code file to see exactly what changed. Enable ignore whitespace to filter out formatting noise. Essential for pull request reviews and debugging.
Document Editing
When a colleague sends back an edited document, paste both versions to see every change they made. Faster than reading through the entire document trying to spot edits manually.
Contract Comparison
Legal contracts often change by just a few words between versions. Word-level diff catches even the smallest modifications — a changed date, a different dollar amount, or a reworded clause.
Configuration Files
Compare staging and production configs to verify only the intended changes are present. Spot the one changed value that broke a deployment without reading every line.
Translation Verification
Compare two versions of a translated document to verify all changes were applied consistently and nothing was accidentally left out or mistranslated.
API Response Comparison
When an API behaves differently between environments, diff the JSON responses to pinpoint the exact field that changed. Enable ignore whitespace for clean results.
Log File Debugging
Compare a working log output against a broken one. The diff highlights the exact line where the behavior diverged, saving hours of manual scanning.
SEO Content Tracking
Diff revisions of an article to verify that important terms, internal links, or calls to action were not accidentally removed during editing.
Note: a diff checker compares two texts you supply — it is not a plagiarism checker, since there is no web or database search behind it.
Diff Checker vs Git Diff
When to use a browser-based diff checker and when to reach for git.
| Feature | Browser Diff Checker | Git Diff |
|---|---|---|
| Setup required | None — open browser | Git installed, repo initialized |
| Input method | Paste text or upload files | Compares tracked files in repo |
| Works without repo | Yes | No |
| Works on mobile | Yes | No |
| Compares arbitrary text | Yes | Only tracked files |
| History and blame | No | Full history, blame, log |
| Staged vs unstaged | N/A | Yes |
| Large file support | No hard limit (~50K+ chars may slow down) | Handles gigabytes |
Use the browser diff checker for quick ad-hoc comparisons when you have two pieces of text and just need to see what changed. Use git diff for ongoing development work where you need version history, staged comparisons, and integration with your workflow.
Frequently Asked Questions
Answers to common questions about the diff checker tool.
Different formatting, not different data. When you run an online text compare on JSON, one side is pretty-printed and the other is minified or uses different indentation, so every line differs. Pretty-print both with the same formatter first — or enable ignore-whitespace — and only real value changes will light up.
The AFFLIGO diff checker uses the LCS (Longest Common Subsequence) algorithm. It finds the longest sequence of lines that appear in both texts in the same order, then marks everything else as added or removed. For word-level diffs, it applies the same algorithm to individual words within changed lines — highlighting word differences precisely.
When ignore whitespace is enabled, the tool collapses multiple spaces into a single space and trims leading and trailing whitespace before comparing. This prevents minor formatting changes like re-indentation from showing up as differences.
When ignore case is enabled, the tool converts all text to lowercase before comparing. This means Hello and hello are treated as the same, so only actual content differences are highlighted regardless of capitalization.
Enable ignore-whitespace when comparing reformatted code or JSON with different indentation — it hides spacing-only noise. Add ignore-case for prose drafts where capitalization changed but words did not. Use both for pasted content from different editors; disable both for legal or code review where every character matters.
Diffs Only mode hides all unchanged lines from the results. It shows only the lines that were added, removed, or modified, making it easier to focus on what changed without scrolling through identical content.
No. All comparison happens entirely in your browser using JavaScript. Your text never leaves your device, so it stays completely private. You can verify this by opening browser DevTools, switching to the Network tab, and confirming zero requests fire during comparison.
You can upload text-based files (.txt, .js, .py, .json, .html, .css, .xml, and 20+ more). Click the upload icon next to each textarea to load a file. The tool reads the file in your browser without uploading it to any server. Supported content includes source code, JSON, XML, SQL dumps, CSV exports (save Excel sheets as CSV first), config files, and prose. For Word or PDF files, copy the text out — or compare PDFs directly with our Compare PDF tool.
Unified diff is a standard text format used by git, GNU diff, and code review tools. It shows removed lines prefixed with - and added lines prefixed with +, with 3 lines of context around each change. You can copy this format and paste it into PR comments, bug reports, or apply it as a patch.
Paste the original JSON in the left panel and the modified JSON in the right panel. Enable ignore whitespace to normalize indentation differences. For best results, pretty-print both JSON objects with consistent formatting before comparing, so only actual value changes appear.
Key Takeaways
- Word-level comparison catches single-word edits that line-by-line mode hides in long text
- Ignore-whitespace and ignore-case options prevent false positives from formatting changes
- Unified diff view is standard for code review — learn to read the + and - notation
- Verify privacy in DevTools: zero network requests fire during comparison
- Copy-paste directly from your editor to preserve original formatting and avoid line break issues
I compared two 200-line configs: word-level highlights caught a single changed flag I had missed on visual scan, and the Copy Diff output pasted cleanly into a PR comment. A 60K-char paste triggered the 50K warning but still completed.
Sources: Git diff documentation, Myers O(ND) difference algorithm paper.
