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, ornginx.conffiles 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
v1andv2. - 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
- 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).
- 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.
- 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.
- 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
- Paste both snippets into the Diff Checker with Whitespace Visible enabled.
- The diff immediately flags 3 modified lines:
- Line 2 (
REDIS_HOST): Highlights a trailing space (·) at the end ofcache.internal.shift.iothat was causing DNS lookup failure! - Line 3 (
REDIS_PORT): Highlights6379→6380at the character level. - Line 5 (
DB_POOL_MAX): Highlights20→50.
- 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
.pdffiles 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.