Skip to content

Text diff

Paste two versions to see exactly what changed.

Differences

Paste two versions above to compare them line by line.

Your files are open only in this tab. Nothing is uploaded.

How to use Text diff

  1. Add both versions. Paste text into Original and Changed, click Try an example for a sample YAML config, or click Open file to compare two text files online free up to 5 MB each.
  2. Filter formatting noise. Toggle Ignore case or Ignore spacing above the diff table if you want to skip capitalization or whitespace changes.
  3. Inspect the changes. Switch View between Side by side and Unified to read line numbers and word-level highlights.

Everything runs in this browser tab. Nothing you paste or open is uploaded or logged, so it's safe for keys, tokens and private data.

Online diff checker for texts and local files up to 5 MB

Reviewing config edits, SQL migrations, or draft revisions often involves sensitive strings that should never be pasted into a file difference checker backed by a remote server. Running a client-side confidential text diff inside your browser tab keeps source code, environment variables, and legal drafts completely private with zero network uploads.

Loading Original and Changed files with zero uploads

Paste your baseline text into Original and the updated draft into Changed, or click Try an example to load a sample YAML configuration diff. Both panes also include an Open file button that reads local UTF-8 files up to 5 MB (5,000,000 bytes) directly via the MDN File and Blob text() API Reference.

Because diffLines normalizes both Windows \r\n and Unix \n line endings when splitting lines, moving files between operating systems does not flood the output with false changes. If you need to compare contracts, invoices, or multi-page reports saved in PDF format rather than plain text, compare two PDF documents word by word in a dedicated local workspace.

Reading live +added and -removed line counts

Above the comparison table, the Differences header updates live with exact +N added and -N removed line counts. When both inputs match under your active filters, the header reports No differences so you can confirm parity immediately.

Because every comparison runs purely in memory inside your browser tab, you can disconnect from the network once the page loads and continue auditing sensitive files offline.

Word-level highlighting, Ignore case, and Ignore spacing

Scanning two long lines to spot a single changed port number or typo wastes time when an entire line is shaded red or green. Pairing consecutive removed and added lines with inline word highlighting pinpoints the exact changed tokens inside modified rows.

How 30% line similarity triggers inline word diffs

The diff engine computes a longest-common-subsequence (LCS) alignment using a flat Uint32Array buffer, a typed memory structure documented in the MDN JavaScript TypedArray Reference. First, it trims identical prefix and suffix lines so unchanged headers and footers cost zero table memory.

When a run of removed lines is followed immediately by added lines, each pair is compared word by word. If at least 30% of the longer line’s characters remain identical, only the changed words receive stronger highlight badges; otherwise, the full lines display as replaced.

Normalizing letter case and whitespace runs before diffing

Checking Ignore case folds both inputs to lowercase during line matching, while Ignore spacing collapses consecutive spaces or tabs and trims line edges. Even with those filters enabled, the rendered table preserves your original casing and indentation so you can inspect the exact source text. If a draft has inconsistent capitalization you want to fix permanently rather than ignore, standardize capitalization across drafts using the case converter.

How does the diff engine handle files over 20,000 characters?

Comparing large logs or generated manifests on the main UI thread can stutter while you type. Whenever combined text exceeds 20,000 characters, this tool automatically moves the LCS calculation into a background Web Worker and paginates long outputs 1,000 lines at a time.

Automatic Web Worker offloading with 120 ms debounce

Below 20,000 combined characters, diffs update synchronously on every keystroke. Above 20,000 characters, the UI debounces edits by 120 ms, shows Comparing… in the header, and runs diffLines in a worker thread built on the MDN Web Workers API Reference.

If you are comparing two minified API responses where every key sits on one giant line, prettify minified JSON payloads with the JSON formatter first so each property gets its own line number.

Progressive 1,000-line pagination and LCS cell limits

To keep browser memory bounded on extreme inputs, the LCS table caps its matrix at 4,000,000 cells (roughly 16 MB). Long diff outputs render the first 1,000 rows immediately and display a Show 1,000 more lines button at the bottom so DOM layout never stalls.

When should you use Side by side vs Unified diff viewer?

Choose Side by side when comparing structured configs, prose drafts, or wide code lines where reading old and new columns horizontally makes edits obvious. Switch to the Unified diff viewer on narrow screens or when scanning sparse changes across a long file in a single vertical stream.

The Unified layout mirrors the dual line-number and +/- marker conventions defined in the POSIX diff Utility Specification. Both views highlight inline word changes identically and stay synced when you toggle filters. Use the table below to pick the right view and filter settings for your task.

View or filter Layout & columns Best suited for Pagination & limits
Side by side Two columns with line numbers Config files, prose, wide code 1,000 rows per page
Unified Single stream with before/after numbers Narrow screens, sparse patches 1,000 rows per page
Ignore case Case-insensitive line key SQL keywords, log levels Preserves original display case
Ignore spacing Collapses spaces and trims edges Indentation refactors Preserves original indentation

Tip: Need to extract or verify patterns inside a changed log block before comparing? Test your expression in Regex tester with live match highlighting.

Questions

Can I compare formatted PDF files instead of raw text?

Use Compare PDFs for PDF files. That tool extracts text from both PDF documents locally and highlights word-level additions and deletions across pages, whereas Text diff compares plain text, code, and configuration files.

Why do CRLF and LF line breaks cause false differences?

Some diff tools treat Windows CRLF (\r\n) and Unix LF (\n) endings as changed lines even when text is identical. This tool splits both inputs on either \r\n or \n before comparing, so mixed line endings never trigger false differences.

What is the maximum file size for comparing text files?

Each Open file input accepts plain-text files up to 5 MB (5,000,000 bytes). Combined inputs larger than 20,000 characters automatically shift into a background Web Worker so typing and scrolling stay responsive.

What does Ignore spacing do during comparison?

Checking Ignore spacing collapses runs of spaces or tabs into a single space and trims leading and trailing whitespace on each line before computing line differences. The rendered table still displays your original indentation.

Why are some modified lines highlighted word by word while others are not?

When consecutive removed and added lines are paired, the engine runs a word-level diff if they share at least 30% of their characters. Completely rewritten lines stay highlighted as full-line removals and additions for clarity.

How does the tool stay responsive on files with thousands of lines?

After trimming identical leading and trailing lines, the LCS engine caps its table at 4,000,000 cells and the UI renders 1,000 rows at a time with a Show 1,000 more lines button.

Are pasted texts or opened files ever uploaded to a server?

No. File reading and line diffing run 100% locally inside your browser tab, so source code, environment configs, and private drafts never leave your device.

Updated