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.

No comparison yet. Paste or upload text in both fields below — results appear here automatically, and nothing is calculated until you do.
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?

| Mode | Best for | Avoid when |
|---|---|---|
| Word | Prose, configs, short scripts | Comparing whole-line code rewrites |
| Line | Source code, CSVs, logs | Spotting single-word edits inside a paragraph |
| Character | Catching typos, swapped digits, ID mismatches | Reviewing 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.
Related comparison tools
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.