← Back to tool

Import · Drag & drop · Compare

Compare Two Text Files Online

Updated: June 2026

When two files are supposed to be the same but behave differently, the answer is almost always a difference you cannot see by scrolling. Comparing the two files line by line turns that invisible change into a highlighted, colour-coded report you can read in seconds — no diff command, no installed software, just your browser.

Compare My Files →

Free · No upload · Reads files locally

How to compare two text files

  • Open the tool and click Import above either panel, or simply drag a file from your desktop onto the box.
  • Do the same for the second file in the other panel.
  • The contents load instantly and the differences are highlighted line by line.
  • Removed lines appear red, added lines green, and edited lines show both versions with the changed words marked.
  • Use the summary to see how many lines were added, removed and how similar the two files are.

You can also mix sources — paste one side from the clipboard and load the other from a file — which is handy when you are comparing a saved file against something you just copied.

Which file types work

Any file that is fundamentally plain text can be compared. The tool reads the raw bytes as text and splits them into lines, so the extension does not really matter as long as the content is human-readable.

TypeExamples
Plain text.txt, .log, .md, .rtf-as-text
Data.csv, .tsv, .json, .xml, .yaml
Source code.js, .py, .css, .html, .java, .sql
Config.env, .ini, .conf, .toml

Binary files such as Word documents, PDFs, images or spreadsheets in their native format will not compare meaningfully because they are not stored as plain text. Export them to a text or CSV format first, then compare those.

Handling whitespace and line endings

Files created on different operating systems often differ only in invisible ways. Windows ends lines with a carriage return plus line feed, while macOS and Linux use a single line feed. The comparison normalises line endings automatically, so a file that was merely saved on a different platform will not show as completely changed.

For other invisible differences you have explicit controls. Turn on Ignore trailing spaces when one file has stray spaces at the ends of lines, Ignore all whitespace when indentation changed but content did not, and Ignore blank lines when only spacing between paragraphs differs. These options change the comparison only — the files are always displayed exactly as they are.

Your files never leave your computer

Files are read with the browser's local FileReader, the same mechanism a web page uses to preview an image before upload — except here there is no upload at all. The content stays in the tab's memory, the diff is computed in JavaScript on your machine, and nothing is transmitted anywhere. That makes it appropriate for contracts, exported customer data, internal logs and proprietary source code that you would never paste into a server-side tool.

Frequently asked questions

How do I compare two text files?

Click Import on each panel or drag a file straight onto it. The contents load into the comparison and the differences are highlighted immediately.

What file types can I compare?

Any plain-text format works: .txt, .csv, .log, .md, .json, .xml, source code and config files. The tool reads them as text and compares line by line.

Are my files uploaded?

No. Files are read locally with the browser FileReader API and never leave your device, which makes it safe for confidential documents.