ShiftTools ShiftTools
Zero-Upload Browser Utility

Code & Text Diff Checker

Compare two text or code blocks locally in your browser. View side-by-side or unified diffs, highlight character-level changes, and ignore whitespace.

Interactive Tool Workspace

Loading local in-browser WebAssembly engine & hardware cryptographic sandbox...

Whether you are checking what changed between two nginx config files, auditing edits in a legal clause before signing, or figuring out why a staging .env file works while production fails, this local diff checker highlights every addition, deletion, and modified word in real time. Paste two blocks of text or code into your browser to inspect side-by-side split views or unified git-style patches with optional whitespace and case filtering - without uploading proprietary source code to a cloud server.

Everyday situations where a fast text diff saves hours

Version control works great when both files live in the same Git repository, but half the comparisons you do during a workday happen between ad-hoc snippets sitting in Slack messages, log files, database rows, or email threads:

  • Comparing staging vs production configuration files: Pasting two .env, docker-compose.yml, or nginx.conf files to spot the one environment variable or port number that drifted out of sync.
  • Reviewing contract or copy revisions: Comparing a client's edited draft against your original paragraph to see every inserted or deleted word without relying on Word's Track Changes.
  • Debugging API responses and SQL queries: Formatting two JSON payloads in JSON Formatter and diffing them here to see exactly which fields changed between API v1 and v2.
  • Checking code snippets before refactoring: Comparing an AI-refactored function against your original implementation side by side before pasting it into your codebase.

Comparing two text or code blocks step by step

  1. Paste Original and Modified text: Paste the baseline text into the left (Original / A) editor and the updated version into the right (Modified / B) editor (or drop two text files).
  2. Choose your view mode: Switch between Side-by-Side (Split View) to read both versions aligned line-for-line, or Unified (Inline View) to read a single continuous diff stream.
  3. Configure comparison rules: Toggle Ignore Whitespace to skip indentation/tab changes, Ignore Case for case-insensitive matching, or Word / Character Diff for inline highlight granularity.
  4. Navigate through changes: Review the summary counters (+X additions, -Y deletions, ~Z unchanged) and copy the unified diff output if needed.

Features that make subtle changes jump off the screen

Line-level + inline character/word highlighting

Basic line diffs paint an entire 140-character line red and green even when only a single semicolon or digit changed in the middle of the line. Our two-tier diff engine first aligns matching lines using the Myers longest-common-subsequence (LCS) algorithm and then highlights the exact changed characters or words inside modified lines with a stronger tint.

Side-by-Side Split View and Unified Patch View

On wide desktop monitors, Side-by-Side mode keeps line numbers synchronized across both columns so you can trace structural changes effortlessly. On narrower laptop split-screens or when preparing a changelog summary, Unified mode condenses additions (+) and deletions (-) into a single vertical view.

Ignore Whitespace and Case toggles

When someone runs Prettier or converts 2 spaces to 4 spaces across a 300-line file, a raw diff lights up all 300 lines as "changed" and hides the two lines of actual logic that were modified. Enabling Ignore Whitespace strips leading/trailing space differences so only real content changes are highlighted.

A real example: catching a subtle bug between two .env configurations

Suppose a service connects to Redis in Staging (8 lines) and throws a connection timeout in Production (8 lines):

Original (Staging .env):

APP_PORT=8080
REDIS_HOST=cache.internal.shift.io
REDIS_PORT=6379
REDIS_TLS=true
DB_POOL_MAX=20

Modified (Production .env):

APP_PORT=8080
REDIS_HOST=cache.internal.shift.io 
REDIS_PORT=6380
REDIS_TLS=true
DB_POOL_MAX=50
  1. Paste both snippets into the Diff Checker with Whitespace Visible enabled.
  2. The diff immediately flags 3 modified lines:
  • Line 2 (REDIS_HOST): Highlights a trailing space (·) at the end of cache.internal.shift.io that was causing DNS lookup failure!
  • Line 3 (REDIS_PORT): Highlights 6379 → 6380 at the character level.
  • Line 5 (DB_POOL_MAX): Highlights 20 → 50.
  1. What looked identical at a glance is solved in five seconds.

Practical tips and limitations

  • Normalize JSON key order before diffing: If you are comparing two JSON objects whose keys were serialized in a different order, format both with Sort Keys Alphabetically in the JSON Formatter first so the diff only highlights true value differences.
  • Comparing full PDF documents: If your documents are .pdf files rather than plain text or source code, use the dedicated Compare PDFs tool, which supports both page-by-page text diffs and visual pixel overlay diffs.

Privacy and local execution

Proprietary source code, .env secrets, SQL dumps, and legal drafts should never be pasted into server-side diff websites that save public "shareable diff permalinks" in a database. This diff checker runs 100% locally inside your browser using JavaScript string comparison - making zero fetch, XMLHttpRequest, or WebSocket calls.

How Myers Longest Common Subsequence (LCS) alignment works

When you compare two blocks of code, a naive line-by-line loop (lineA[i] === lineB[i]) fails completely as soon as you insert one blank line at the top of the file—marking every single subsequent line in the file as "different" because all line numbers shifted by +1.

  • Shortest edit script (SES) calculation: The diff engine constructs an edit graph to find the Longest Common Subsequence of unchanged lines between Document A and Document B. If you insert 5 new lines at line 10 of a 200-line file, the Myers algorithm recognizes that lines 11–205 of the new file still match lines 10–200 of the original file, isolating the green + highlight strictly to the 5 newly inserted lines.
  • Secondary intra-line token diffing: Whenever an adjacent deletion (-) and addition (+) block share high similarity, a second character/word pass runs across that pair so you can spot a single changed variable name or port number inside a long line.

Related tools

Comparing two multi-page PDF contracts or architectural drawings? Use Compare PDFs. Before diffing JSON API responses, normalize their indentation and key order in the JSON Formatter & Validator, or test pattern matches in the Regex Tester. Read our guide on how to use the online diff checker.

Frequently Asked Questions

Are my code snippets or .env files saved on a server when I compare them?

No. All text comparison runs 100% locally in your browser's RAM. Nothing is transmitted over the network, logged, or stored in any database - making it safe for .env files, private source code, and confidential contracts.

How do I ignore indentation changes when comparing formatted code?

Toggle on the Ignore Whitespace option in the toolbar above the diff viewer. The comparison engine will normalize leading and trailing spaces on each line so only actual code or word modifications are highlighted.

What is the difference between Side-by-Side and Unified diff views?

Side-by-Side (Split) view displays the Original text on the left and the Modified text on the right with aligned line numbers, making it easy to read context in both files. Unified view combines both texts into a single column where removed lines are marked in red (-) directly above added lines in green (+).

Can I spot a single changed character inside a long line of text?

Yes. When a line is modified rather than completely added or deleted, the tool runs an inline secondary diff that highlights the exact characters or words that changed inside that line.

How can I compare two JSON files that have keys in a different order?

First paste each JSON payload into the JSON Formatter tool with Sort Keys Alphabetically checked, copy the normalized outputs, and then paste them into the Diff Checker.

Does this tool support comparing PDF or Word files directly?

This tool compares plain text, source code, Markdown, JSON, CSV, and config files. To compare two .pdf files visually or by extracted page text, use the Compare PDFs tool in our PDF Suite.