Load Sample Texts
What Each Diff Symbol Means
When to Use a Diff Checker
What is a Diff Checker?
A diff checker is a tool that analyzes two text blocks and identifies exactly what changed between them, at the line level. The result displays added lines (+), removed lines (−), and unchanged lines, letting you instantly spot what changed without re-reading the entire document.
While diff tools are most commonly associated with software development — comparing file versions before merging, reviewing pull requests, or auditing configuration changes — their value extends far beyond code. Legal teams compare contract revisions, writers track document changes, and sysadmins audit config file diffs to catch unintended modifications before deployment.
How Diff Algorithms Work
ZestLab Diff Checker uses the LCS (Longest Common Subsequence) algorithm — the same mathematical foundation underlying most modern diff tools, including Git.
The algorithm works in two phases:
- Phase 1 — Build the LCS table: Split both texts into line arrays. Use dynamic programming to build a table
dp[i][j]representing the length of the longest common sequence between the firstilines of the original and the firstjlines of the modified text. Time complexity:O(m × n). - Phase 2 — Backtrack: Walk backwards from
dp[m][n]to classify each line as "unchanged", "added", or "removed".
The Myers diff algorithm (used by Git itself) is more efficient for large files, reducing complexity to O(n × d) where d is the number of edits. For files under a few thousand lines, LCS and Myers produce identical results — Myers just gets there faster on very large inputs.
Side-by-Side vs Unified Diff
There are two primary ways to display diff output:
| Criteria | Side-by-Side | Unified Diff |
|---|---|---|
| Layout | Two columns, one per version | Single column, old/new interleaved |
| Best for | Large files with scattered changes | Small files, concentrated changes |
| Used by | IDE diff (VS Code, JetBrains) | Git CLI, patch files |
| Strength | Full context of both versions at once | Compact, copy-paste friendly |
ZestLab Diff Checker renders a unified diff augmented with dual line numbers — showing both the original line number and the modified line number for each line. This gives you the compactness of unified diff with enough context to navigate large outputs without horizontal scrolling.
Diff for Code Review
In a code review workflow, the diff is the primary artifact. Reviewers do not read entire files — they read diffs. Practices that produce cleaner, reviewable diffs:
- Small, single-purpose commits: Each commit does one thing — refactor OR add feature OR fix bug. Never mix. Reviewers can then understand the intent immediately from the commit message.
- Separate formatting from logic: Running a code formatter (Prettier, Black, gofmt) on the same commit as a logic change creates a massive diff that obscures the actual change. Run formatting as a separate commit.
- Rename before you change: Variable/function renames produce large diffs that overwhelm the actual logic changes. Rename in a dedicated commit first.
- Explain the "why" in PR description: The diff shows what changed. The reviewer needs to understand why. A good PR description turns a 300-line diff into a clear, reviewable story.
Common Diff Mistakes
1. Encoding mismatch
The same content saved as UTF-8 in one file and UTF-16 in another will produce a diff that shows every single line as changed — even though the text looks identical in a text editor. Always normalize encoding to UTF-8 before comparing.
2. Invisible trailing whitespace
"hello " (with a trailing space) looks identical to "hello" on screen but registers as a change in a strict diff. Enable "Ignore whitespace" if you only care about meaningful content changes, not formatting artifacts.
3. Line ending differences (CRLF vs LF)
Windows uses \r\n, Linux/macOS uses \n. Opening a Windows file on Linux without conversion — or vice versa — causes every line to appear as changed. Configure .gitattributes with * text=auto to normalize line endings across platforms in your project.
4. Diffing binary files as text
Text diff is meaningless on binary files — PDFs, images, Word documents. The output is unreadable noise. For binary files, use checksums (MD5, SHA-256) to quickly detect whether a file changed at all, then open the binary in its native tool to review what changed.
Frequently Asked Questions
Related Tools
About Developer Tools
Developer tools automate the repetitive parts of software work: formatting JSON, encoding/decoding Base64, decoding JWTs to verify token claims, generating UUIDs, formatting XML, diffing configurations. These aren't glamorous tasks, but they're the friction points that eat 10-15 minutes multiple times a day — adding up to hours weekly. Running them in a clean browser tab beats wrestling with CLI dependencies or IDE extensions that might ship your private data to a third party.
Why it matters
Fast, client-side developer tools fundamentally matter because they're used with sensitive data. JWT tokens contain user identity. Base64 payloads might encode API keys. JSON dumps include customer records. If a 'developer tool' sends your input to a server to process, you've just leaked production secrets. ZestLab's dev tools run 100% client-side with no network calls after page load — what you paste stays in your browser.
Privacy and safety
All developer tools here execute in-browser using pure JavaScript. There's no 'decode server' or 'format API' — your JWT, your JSON, your encoded payload is parsed by code running on your laptop. Verify this yourself with browser DevTools → Network tab: you'll see zero outbound requests when using any tool. That's a standard we hold because dev tools handle secrets.
Best practices
- Never paste production JWT or API tokens into ANY online tool without verifying it runs client-side (check the Network tab)
- Use browser private/incognito mode for one-off decoding of sensitive payloads
- Bookmark tools you use daily — ZestLab tool URLs are stable and don't require accounts
- When formatting JSON with secrets for team review, redact credentials before sharing the formatted output