How to Use This Tool
Add Your Two Files
Paste text directly into the File A and File B textareas, click Upload to pick a text file (the picker is scoped to ~70 common text extensions like .txt, .json, .csv, .md, .log, .yml, and source code), or drag and drop a text file onto either panel. Files are read locally with a 10 MB per-file size limit, and binary files (PDFs, images, ZIPs) are rejected with a clear error.
Compare
Click Compare. The tool runs a true Longest Common Subsequence (LCS) line diff on your inputs and renders the result in a side-by-side split view: matching lines highlighted light green on both sides, differing lines highlighted light red on both sides (including any empty cell where one file has a line and the other does not), and matching blank lines left plain white so they do not visually clutter the view. Per-side line numbers come from the diff, not row position.
Navigate Differences
Use the ↑ Prev and ↓ Next buttons to jump between the next differing row. The counter shows your exact position out of the total number of differences, and the matching row scrolls into view in the split panel. The stats bar shows matched lines, different lines, and per-side total line counts.
Export & Reset
Click Copy Diff to copy a unified-format diff (with +/- prefixes) to your clipboard, or Download to save it as diff-output.txt - both come from the same LCS result that powers the on-screen view. Use ⇄ Swap to switch File A and File B (the comparison auto-reruns), or Clear All to wipe both files and the saved data.
Frequently Asked Questions
Is my file uploaded to a server?
▼
No. Both files are read directly in your browser - all comparison, sorting of differences, and copy/download output happens on your device using JavaScript. No upload, no proxy, no analytics, no tracking. The only data that ever leaves your browser is what you explicitly choose to copy or download yourself.
What kind of diff algorithm does it use?
▼
It runs a true Longest Common Subsequence (LCS) line diff. That means it correctly handles inserted and missing lines instead of just comparing line 1 to line 1. If File B has one extra line at the top compared to File A, only that one line is marked as different - everything below it is still recognized as matching.
What file types are supported?
▼
Plain text only - source code, configs, logs, CSV/TSV, JSON, XML, HTML, Markdown, SQL, SVG, .env files, and similar. The file picker is scoped to ~70 common text extensions, and any file containing NUL bytes (a strong signal of binary content like images, PDFs, or ZIPs) is rejected with a clear error before comparison.
Is there a file size limit?
▼
Yes - 10 MB per file. Files larger than that are rejected before being read, so the browser tab will not freeze trying to load a giant log dump. For most source files, configs, and JSON exports this is more than enough.
How are line endings handled?
▼
CRLF (Windows) and CR (classic Mac) line endings are normalized to LF (Unix) before the diff runs, so a Windows-saved file and a Unix-saved file with otherwise identical content will be reported as identical instead of all lines being marked as different.
What about UTF-8 BOM and encoding?
▼
A leading UTF-8 BOM (the invisible 0xFEFF marker that Notepad and some editors add at the start of a file) is stripped automatically so it does not show as a phantom difference on line 1. The tool reads files as UTF-8 - other encodings (like Windows-1252 or Shift-JIS) may show garbled characters and should be re-saved as UTF-8 first.
Does the side-by-side view match what I copy or download?
▼
Yes. The on-screen split view, the Copy Diff output, and the Download .txt file are all generated from the same LCS diff result, so what you see is exactly what you export. Matching lines are pair-aligned on the same row, lines that exist only in File A appear on the left only, and lines that exist only in File B appear on the right only.
Will my work be lost if I refresh the page?
▼
No. File A and File B contents are saved to your browser's localStorage and restored automatically on the next visit, and the comparison is re-run on load. Click Clear All to wipe both files, the diff, the navigation state, and the persisted data immediately.
Compare Files Online Free - No Upload Required
Compare two text files online for free with this browser-based file difference tool. Paste two snippets, upload .txt / .json / .csv / .md / source code / config files, or drag and drop them onto the panels - the tool runs a true Longest Common Subsequence line diff entirely in your browser and shows the result in a side-by-side split view: matching lines in light green, differing lines in light red. Your files are never sent to our servers. No registration or software installation required.
This online file diff checker correctly aligns matching lines around inserted and missing lines (not naive line-by-line position matching), normalizes Windows / Mac / Unix line endings, strips UTF-8 BOM markers, rejects binary files with a clear error, caps inputs at 10 MB per file, and saves both files to localStorage so your work survives a refresh. Features include side-by-side split view with sticky header, per-side line numbers from the diff, prev/next navigation between every difference, unified-format Copy Diff and Download .txt export, one-click swap, keyboard shortcuts (Ctrl+Alt+C/R/S), and a stats bar showing matched and different line counts. No registration needed to start comparing instantly.
Features Explained
True LCS Line Diff
▼
The tool uses a Longest Common Subsequence dynamic programming algorithm to compute the diff. That means inserted and missing lines are detected correctly - if File B has one extra line at the top compared to File A, only that one line is marked as different and every line below it is still recognized as matching, instead of the whole file being marked as different.
Side-by-Side Split View
▼
Both files render in a two-column table with a vertical divider, a sticky header showing "File A" and "File B", and a 60vh scroll container. Rows are aligned from the LCS result so what you see on screen matches exactly what you copy or download - no mismatch between the visual view and the export.
Two-Color Match / Different Highlighting
▼
Matching lines are tinted light green on both sides. Differing lines are tinted light red on both sides - including any empty cell on the side where the line is missing entirely. Matching blank lines are left plain white so empty space in the file does not visually clutter the view. The color scheme is intentionally directional-neutral: there is no "old" or "new" file, just File A and File B.
Per-Side Line Numbers
▼
Each row shows the actual line number from File A on the left gutter and from File B on the right gutter. These numbers come from the diff itself, so a row containing a line that exists only in File A shows only an A number, a row containing a line that exists only in File B shows only a B number, and matching rows show both - reflecting the real positions in each file rather than the row position in the table.
Difference Navigation
▼
When the diff contains any differing rows, an ↑ Prev / ↓ Next pair appears in the stats bar with a counter like "3/12" showing your current position out of the total number of differing rows. Clicking either button advances or rewinds the cursor and smoothly scrolls the matching row into view at the center of the split panel.
Diff Stats Bar
▼
Above the split view, a stats bar shows how many lines matched, how many differed, and the total line count of each side (File A / File B). Every number comes from the LCS result so the stats always agree with the visual view and the export.
Copy Diff to Clipboard
▼
Click Copy Diff to copy the full diff to your clipboard in unified format - matching lines are prefixed with a space, lines unique to File A with a minus, and lines unique to File B with a plus. This is the same format git diff and patch files use, so it pastes cleanly into chats, tickets, code reviews, and most text editors with diff syntax highlighting.
Download as .txt
▼
Click Download to save the same unified-format diff as diff-output.txt. The blob is created locally and the object URL is revoked immediately after the download triggers, so there is no memory leak.
Swap A & B
▼
Click ⇄ Swap to instantly switch File A and File B contents. If a comparison is already active, it auto-reruns on the swapped content so the split view, stats, and navigation update in place - useful when you realize you loaded the files in the wrong order.
Drag & Drop or Upload
▼
Each panel is a drop zone with a highlighted overlay while you drag a file over it. You can also click the Upload button next to the File A / File B label to open a file picker. Both paths share the same loader, so size, encoding, and binary checks apply consistently.
10 MB Per-File Size Limit
▼
Files larger than 10 MB are rejected before being read with a clear error like "file.log is 23.4 MB - the maximum is 10 MB per file". This stops a giant log dump or accidental binary export from freezing the browser tab.
Binary File Rejection
▼
After reading a file, the tool scans the first 4 KB for NUL bytes - a strong signal of binary content. If any are found, the file is rejected with an error explaining that only plain text is supported, so dropping a PNG, PDF, or ZIP shows a polite message instead of a screen full of garbled mojibake.
Line Ending Normalization
▼
CRLF (Windows) and CR (classic Mac) line endings are converted to LF (Unix) before the diff runs. A file saved on Windows and the same file saved on Linux will be reported as identical instead of every line being marked different because of an invisible \r.
UTF-8 BOM Stripping
▼
If a file starts with a UTF-8 BOM (the invisible 0xFEFF marker that Windows Notepad and some editors add), it is stripped from the loaded text so it does not appear as a phantom difference on line 1.
localStorage Persistence
▼
File A and File B contents are saved to your browser's localStorage under the keys "diff-tool-a" and "diff-tool-b" and restored automatically on the next visit. If both files are restored, the comparison is re-run on load so you land back exactly where you left off.
Keyboard Shortcuts
▼
Focus the tool and press Ctrl+Alt+C to compare, Ctrl+Alt+S to swap, or Ctrl+Alt+R to clear all - faster than reaching for the mouse when iterating on small text edits between runs.
Who Is This Tool For?
Software Developers
Compare two versions of a source file, two branches' configs, or before/after refactor snippets without firing up a full git client or IDE.
Code Reviewers
Spot-check a single file or function from a pull request by pasting both versions side by side and walking the changes with Prev/Next.
DevOps Engineers
Diff Kubernetes manifests, Helm values, Terraform plans, Ansible playbooks, and Dockerfiles between environments to find drift before deploying.
System Administrators
Compare /etc config files, sshd_config, nginx.conf, and crontabs between servers to track down inconsistencies that cause weird behavior.
Site Reliability Engineers
Diff log file slices, postmortem snippets, and runbook revisions when chasing regressions or building incident timelines.
QA Engineers
Compare expected vs. actual output from test runs, snapshot files, and API response captures to identify exactly which lines drifted.
Test Automation Engineers
Diff golden files and recorded fixtures against new test outputs without re-running the whole suite, then update the golden file with confidence.
Data Engineers
Compare CSV/TSV exports from two ETL runs to confirm row-level changes, or diff JSON/JSONL dumps from two database snapshots.
Database Administrators
Diff schema dumps, migration scripts, and view definitions between environments to spot accidental schema drift.
Security Researchers
Compare suspect config files against a known-good baseline, or diff malware sample strings against an earlier capture, all locally so nothing leaves the browser.
Penetration Testers
Diff scanner outputs from two runs against the same target to see what new findings appeared after a fix or rotation.
IT Auditors
Verify that two compliance config exports match an approved baseline by pasting them in and reviewing every flagged line.
Tech Support Staff
Compare a customer's config or log against a known-working reference to find the one line that explains the issue.
Technical Writers
Diff two drafts of a Markdown article, README, or release-notes file to confirm exactly which lines changed before publishing.
Translators & Localizers
Compare two versions of a translation .po, .strings, or JSON locale file to spot new keys, removed keys, and modified strings.
Legal & Contract Reviewers
Paste two plain-text revisions of a clause or agreement and instantly see every line-level edit between them.
Academic Researchers
Diff two drafts of a manuscript section or two versions of a CSV dataset row by row to verify reviewer changes.
Students
Compare your assignment with a sample solution, or two of your own attempts, to see exactly which lines differ and learn from the changes.
Educators & Trainers
Demonstrate diffing, line-by-line comparison, and patch concepts in coding, DevOps, and version-control lessons without setting up git.
Open Source Maintainers
Reproduce and triage bug reports that include before/after file snippets by pasting both into the tool and walking the diff.
Product Managers
Diff two exported config sheets or feature-flag dumps to confirm which switches actually changed during a release.
Game Developers
Compare two save files, level configs, or asset manifests to spot the entries a tweak actually changed in the build pipeline.
Embedded Engineers
Diff firmware config headers, device tree snippets, and build manifests between board revisions to track regressions.
Anyone with two text files
Whenever you just need to know what changed between two text files and would rather not learn a command-line diff tool, this is the fastest way.
Tips for Comparing Files
Trust the LCS diff, not row position
The split view is built from a real LCS line diff. If File B has one extra line at the top, only that line shows as different - the rest of the file still aligns correctly. Naive "line 1 vs line 1" tools cannot do that.
Use Prev/Next to walk every difference
Once a comparison is rendered, the ↑ Prev / ↓ Next buttons jump straight to each differing row and scroll it to the center of the panel. Faster than scrolling looking for red stripes.
Two colors, that's it
Light green on both sides = matching line. Light red on both sides (including any empty cell) = differing line. Plain white = a matching blank line that was left unhighlighted to keep the view clean. There is no third color and no "old vs new" direction - File A and File B are treated as equal peers.
Look at the line numbers, not the row numbers
Each side shows its own real line number, so a row containing a line that only exists in File A shows only an A number, and a row containing a line that only exists in File B shows only a B number. That tells you exactly where the difference lives in each original file.
Swap when you loaded them backwards
Realize you put the files in the wrong panels? Click ⇄ Swap and the comparison auto-reruns on the swapped content - no manual reload needed.
Save Windows files as UTF-8 first
The tool strips UTF-8 BOM markers automatically and normalizes CRLF/CR line endings to LF, so a Notepad-saved file and a Linux-saved file with the same content will be identical. Other encodings (Windows-1252, Shift-JIS) may show garbled characters - re-save as UTF-8 first.
Binary files are rejected on purpose
Dropping a PDF, PNG, ZIP, or other binary file shows a clear error instead of garbled mojibake. The tool checks for NUL bytes in the first 4 KB to decide. If you really want to compare a binary file's text strings, run it through a text-extraction tool first.
Stay under 10 MB per file
Files larger than 10 MB are rejected before they are read - this protects your browser tab from freezing. For most source files, configs, and JSON exports this is plenty. For huge logs, slice the relevant section first.
Copy the diff to share in chat or tickets
Click Copy Diff to grab a unified-format diff (with +/- prefixes, just like git diff) and paste it straight into Slack, Jira, GitHub, or an email - the format renders nicely in code blocks.
Download for permanent records
Click Download to save the same diff as diff-output.txt. Useful for change logs, postmortems, and compliance evidence where you need a file rather than a clipboard snippet.
Use Ctrl+Alt+C / S / R
Compare = Ctrl+Alt+C, Swap = Ctrl+Alt+S, Clear = Ctrl+Alt+R. Focus the tool first (click anywhere inside it), then iterate without touching the mouse.
Your work survives a refresh
Both files are saved to localStorage and the comparison is re-run on the next visit. Click Clear All when you are done to wipe both files, the diff, the navigation state, and the persisted data in one go.
Supported Input Formats
The File A and File B panels accept plain text only. Binary files are rejected with a clear error. The file picker is scoped to ~70 common text extensions, but you can paste any text directly into the textareas if your file uses an unlisted extension.
| Category | Examples | Status |
|---|---|---|
| Plain text & docs | .txt, .md, .markdown, .log, .csv, .tsv | Supported |
| Data formats | .json, .jsonl, .ndjson, .xml, .yml, .yaml, .toml, .ini, .env | Supported |
| Source code | .js, .ts, .tsx, .jsx, .py, .java, .c, .cpp, .h, .cs, .go, .rs, .rb, .php, .swift, .kt, .lua, .r, .pl, .dart, .sql | Supported |
| Web | .html, .htm, .css, .scss, .sass, .less, .vue, .svelte, .svg | Supported |
| Shell & build | .sh, .bash, .zsh, .ps1, .bat, .cmd, .gradle, .properties, .lock, .diff, .patch, .dockerignore, .gitignore, .editorconfig | Supported |
| Binary files | .pdf, .png, .jpg, .zip, .docx, .xlsx, .mp4, .mp3 | Rejected (NUL byte detected) |
| Files over 10 MB | any file > 10,485,760 bytes | Rejected (size limit) |
You can get text into each panel four ways:
- Type or paste directly into the File A or File B textarea.
- Upload button - opens a file picker scoped to the supported text extensions above. The file is read locally with
File.text(), with size, BOM, and binary checks applied. - Drag and drop - drop a text file onto either panel. The drop zone highlights while dragging and the same loader runs.
- ⇄ Swap - swaps the existing File A and File B contents in one click and re-runs the comparison.
Per-file size cap: 10 MB. Encoding: UTF-8 with automatic BOM stripping. Line endings: CRLF and CR are normalized to LF before diffing. Other encodings (like Windows-1252 or Shift-JIS) may show garbled characters - re-save as UTF-8 first.
Privacy & Security
This free file difference tool runs entirely in your browser. Your File A and File B contents, the LCS diff result, and the copy/download output are never sent to our servers - all reading, comparison, alignment, and rendering happens on your device using JavaScript.
File A and File B are stored safely in your browser's localStorage under the keys diff-tool-a and diff-tool-b so they persist across page refreshes. This data lives only on your computer. Click Clear All to remove both files, the diff, the navigation state, and the persisted localStorage entries immediately. We have no logs, no analytics, no tracking, and no database.