DiffForge

Zero-Upload Myers Diff & Semantic JSON Workbench

Compare text, code, and JSON without leaving your browser.

Paste snippets or drop two local files for instant side-by-side highlights, semantic JSONPath diffing, and Git-compatible .patch exports.

Samples:
+0-0100% match0.0ms

Zero-Upload Privacy

Every comparison runs inside local browser memory. Proprietary source code, .env secrets, and API payloads never touch a remote server.

Semantic JSON Diff

Canonicalizes nested JSON keys alphabetically and surfaces exact JSONPath additions, removals, and type changes without key-order noise.

Myers O(ND) Speed

Prefix/suffix trimming paired with bounded Myers diffing calculates line and word-level inline highlights in sub-millisecond time.

Git-Ready .patch Export

Generates valid unified diff headers and @@ hunk offsets ready for git apply, pull request reviews, or downloadable .diff archives.

Technical Guide

How Client-Side Text, Code, and Semantic JSON Diffing Works

Comparing two revisions of a configuration file, API payload, or legal clause looks simple on the surface, yet subtle whitespace shifts, reordered JSON keys, and server-side logging make legacy online diff tools slow and risky. Here is how DiffForge computes deterministic differences directly inside your browser.

1. Why Zero-Upload Architecture Matters for Code & Configs

Engineers routinely compare environment files (.env), production webhook payloads, JWT claims, database migration scripts, and proprietary contracts. Traditional web-based diff tools often transmit both inputs to remote backend APIs over HTTP POST requests for server-side processing or share-link storage. Even when a provider promises temporary retention, sending credentials or customer records across third-party servers violates zero-trust security boundaries.

DiffForge executes 100% locally in your browser's JavaScript runtime. Dropped files are read strictly via the native FileReader API without initiating network transfers. When you copy a shareable link, state is encoded directly in your browser address bar rather than persisted in an external database.

2. The Myers O(ND) Algorithm & Intraline Token Highlighting

Under the hood, DiffForge implements Eugene Myers' classic shortest-edit-script algorithm—the same algorithmic foundation used by git diff. Before building the edit graph, the engine trims identical leading prefixes and trailing suffixes in linear O(N) time. For typical code edits and configuration updates where 90% of lines remain unchanged, this preprocessing reduces the active problem size dramatically so comparisons render in under a millisecond.

Line-level diffs alone often obscure small edits inside long lines, such as a single changed query parameter or typo in a paragraph. Whenever DiffForge pairs a deleted line with an added line in Split View, it runs a secondary token-level Myers pass across words, identifiers, and punctuation, wrapping only the modified tokens in high-contrast inline highlights.

3. Solving False Positives with Semantic JSON Diff Mode

Standard line-by-line text comparison struggles with JSON documents. Two API responses can carry identical business data while differing completely in key order or indentation. A naive text diff flags dozens of spurious additions and deletions simply because "version" appeared before "service" in one payload.

Toggling Semantic JSON activates DiffForge's recursive canonicalizer. Both inputs are parsed with native JSON.parse, object keys are sorted deterministically at every nesting depth while preserving array indices, and pretty-printed at two-space indentation before diffing. Simultaneously, a structural AST walker records exact JSONPath mutations—categorized cleanly as ADDED, REMOVED, CHANGED, or TYPE mismatches—so you can audit API breaking changes at a glance.

4. DiffForge vs. Legacy Web Diff Tools vs. Desktop IDEs

CapabilityDiffForgeLegacy Web Diff SitesDesktop CLI / IDE
Data Privacy100% browser memoryOften uploaded to serversLocal disk only
Semantic JSON & PathsBuilt-in key sort & JSONPathPaywalled or separate toolRequires jq / extensions
Unified .patch Export1-click copy & .diff fileRarely supportedgit diff --no-index
Ads & SignupsZero ads, zero loginBanner ads & pro upsellsSetup required

5. Practical Workflows for Developers, Writers & QA Teams

  • Comparing Staging vs. Production Environment Variables: Drop both .env snapshots into the dual panes and enable Collapse unchanged to isolate missing keys or mismatched timeouts immediately.
  • Auditing Webhook & REST API Upgrades: Enable Semantic JSON and switch to the JSON Paths tab to verify whether a backend release altered response types or removed deprecated fields.
  • Creating Portable Patch Files Without Git: Paste two versions of a configuration file, click Export .diff, and apply the generated unified patch directly in any repository using git apply diffforge-changes.diff.
  • Reviewing Contract & Policy Redlines: Paste two drafts of a terms agreement or blog article to inspect word-level deletions and additions side by side without uploading sensitive client drafts to cloud document suites.

FAQ

Frequently Asked Questions

Does DiffForge upload my text, code, or JSON files to a server?

No. DiffForge executes 100% locally in your web browser. Pasted snippets and dragged-and-dropped files are processed exclusively in client-side memory via JavaScript and the native FileReader API, with zero server uploads or logging.

How does Semantic JSON diffing differ from standard text comparison?

Standard text comparison treats reordered object keys or different indentation as changes. Semantic JSON mode parses both documents, recursively sorts object keys alphabetically, formats them uniformly, and reports exact JSONPath additions, removals, value edits, and type changes.

What diff algorithm does DiffForge use?

DiffForge uses Eugene Myers shortest-edit-script O(ND) algorithm with linear prefix/suffix trimming for line comparisons, paired with a secondary token-level Myers pass for word and punctuation inline highlights.

Can I export a Git-compatible unified patch (.diff) file?

Yes. Switch to the Patch view or click Copy .patch / Export .diff in the toolbar to copy or download a standard unified diff containing --- / +++ file headers and @@ hunk line offsets compatible with git apply and patch.

Can I compare two local files without copying and pasting?

Yes. Drag and drop any plain-text file (.txt, .json, .ts, .js, .md, .env, .yml, .csv, .sql, .xml) directly onto the Original or Modified editor panes, or click Load file to select a file from disk.

How do Ignore Whitespace, Ignore Case, and Collapse Unchanged work?

Ignore whitespace trims leading/trailing spaces and collapses internal whitespace runs during line matching. Ignore case compares lines case-insensitively. Collapse unchanged hides long runs of matching lines while preserving three lines of context around every change.

Is my data saved if I accidentally refresh the page?

DiffForge automatically caches your active workbench inputs and toggle preferences in your browser localStorage so accidental refreshes do not lose your work. Click Clear at any time to wipe the editors and stored draft.