Compare Text Files Online — Free & Private

Drop two text files — .txt, .md, .csv, .log, .json, .yaml, or source code — and see every difference highlighted word by word. SnapTextCompare reads files locally with the browser's File API; nothing is ever uploaded.

Local-only processing — your text files never leave your device.
Two overlapping translucent text documents representing local-only text file comparison

No comparison yet. Paste or upload text in both fields below — results appear here automatically, and nothing is calculated until you do.

Precision:
View:

Compare your two texts

Original Text (A)
0 words

Modified Text (B)
0 words

Supported Text File Formats

Plain text

.txt, .md, .rtf — loaded directly, no conversion.

Code & config

.js, .ts, .py, .go, .json, .yaml, .xml, .env, .conf.

Data & logs

.csv, .tsv, .log, .ndjson — perfect for spotting drift.

When You'd Compare Text Files

Config drift. Diff a working .env or nginx.conf against a broken one to find the offending line in seconds. Indentation, trailing whitespace and quote style are all preserved, so silent parser errors become obvious.

Log analysis. Compare two log windows to spot new error patterns after a deploy. Pair with line-level diff so each log line is treated as an atomic unit — far more readable than word-level on logs.

CSV reconciliation. Compare yesterday's export against today's to see exactly which rows changed. Switch to line mode and changed rows surface immediately; switch to word mode to see which column inside a row changed.

Code review without git. Compare two snippets without opening an IDE or pushing a branch. Useful for ad-hoc reviews, gist comparisons, or pasting from Stack Overflow vs your local version.

Documentation versioning. Diff two README revisions before publishing to confirm only the intended sections were touched.

Translation QA. Diff an original locale file (en.json) against a translated one (fr.json) to verify all keys are still present and nothing was accidentally removed.

Word vs Line Diff — Which to Pick?

Abstract visualization of horizontal diff bars showing added and removed lines in a text comparison
ModeBest forAvoid when
WordProse, configs, short scriptsComparing whole-line code rewrites
LineSource code, CSVs, logsSpotting single-word edits inside a paragraph
CharacterCatching typos, swapped digits, ID mismatchesReviewing large rewrites — output gets noisy

How the Browser Reads Your Text Files

When you drop a file onto SnapTextCompare, the browser exposes it as a File object via the HTML5 File API. We call file.text(), which returns a Promise resolving to the decoded string. The decoder first checks the byte-order mark — UTF-8 BOM (EF BB BF), UTF-16 LE/BE — and otherwise defaults to UTF-8, which is the format roughly 98% of modern text files use.

The decoded string is then tokenised. For word mode, the input is split on Unicode word boundaries (so "naïve" and "co-operate" stay intact). For line mode, it is split on \n after normalising Windows \r\n and old Mac \r line endings — that prevents an entire file showing as "changed" purely because it was saved on a different OS.

The diff itself runs in the same JavaScript thread, but for files over ~1 MB the comparison is moved off the critical render path so the page stays responsive. None of this requires a server — the entire pipeline is implemented in client-side JavaScript and never opens a network connection with your file content.

Text File Comparison Tips

Normalise line endings before comparing. If one file came from Windows and another from macOS, enable "Ignore whitespace" or pre-convert with dos2unix.

Strip trailing whitespace. Editors silently add or remove trailing spaces. Toggling "Ignore whitespace" filters these out so only meaningful changes remain.

For JSON, format both sides first. Run each file through a formatter so structural keys land on the same lines — otherwise a single re-ordering shows as a complete rewrite.

For CSVs with reordered rows, sort both files (e.g. sort file1.csv > sorted1.csv) before diffing to surface only real value changes.

For very large logs, grep the relevant time window first. A 200 MB log diff is technically possible in-browser, but a 2 MB slice is far easier to read.

How SnapTextCompare works

Diff engine

Google's diff-match-patch (Apache 2.0), running in your browser. Character mode diffs raw characters; word and line modes encode tokens or lines first and diff those, then decode the result.

Similarity & importance

Similarity = 1 − Levenshtein / max(len). Importance weighs each change by category — money and dates score 90+, punctuation scores 3. Deterministic on any device.

Privacy

Files are read with the HTML5 File API and processed in your browser. No network request is ever made with your content — verifiable in the Network tab of your browser's DevTools.

PDF extraction uses pdf.js (Mozilla). Word extraction uses mammoth.js. UTF-8 with or without BOM is auto-detected; CRLF line endings are normalised to LF before diffing so cross-OS files don't appear entirely changed.

Text File Comparison FAQ

Common questions about comparing text files online.

Drop both .txt files into SnapTextCompare. The files are read locally in your browser and a word-by-word diff appears instantly — no upload, no signup.

.txt, .md, .csv, .log, .json, .xml, .yaml, .yml — plus any plain-text source code file (.js, .ts, .py, .go, .rb, etc.).

Comfortable up to about 10 MB per file. Larger files still work but use more memory since processing is in-browser.

Yes — SnapTextCompare never uploads. Files are read with the browser's File API and processed entirely on your device.

Yes. Drop a file on one side and paste text on the other — formats can be mixed freely.

Word-level shows changes within a line (best for prose, configs and short scripts). Line-level shows whole-line changes (best for source code and logs). Toggle freely.

SnapTextCompare auto-detects UTF-8 (with or without BOM) and falls back to the browser's TextDecoder for the rest. If you see mojibake, re-save the file as UTF-8 in your editor.

Yes — that's the most common workflow. Drop yesterday's copy on the left, today's copy on the right, and the diff shows every change between the two saves.