How to Compare Two Text Files: 7 Free Methods for Windows, Mac and Online

How to compare two text files for free: an in-browser diff checker, Windows fc, diff on Mac and Linux, git diff, VS Code and Word, and keeping data private.

By the MakeItFlow team Updated 11 min read
Share LinkedIn X Facebook WhatsApp
How to Compare Two Text Files: 7 Free Methods for Windows, Mac and Online

To compare two text files, the quickest route is to paste both into a diff checker that runs in your browser and read the highlighted changes. On Windows you can also run fc file1.txt file2.txt, on Mac or Linux diff -u file1.txt file2.txt, and anywhere with Git installed git diff --no-index. VS Code and Microsoft Word have built-in comparison too.

Which method suits you depends on what you're comparing and how often. A solicitor checking a returned contract wants something different from a developer checking a config file before a deploy. Below are seven free methods, how to read their output, how to avoid false differences, and why it matters where your text goes when you paste it into an online tool.

Key takeaways

  • For a quick check, paste both versions into a diff checker that runs in your browser, so nothing is uploaded to a server.
  • On Windows, fc file1.txt file2.txt compares files in Command Prompt; in PowerShell type fc.exe, because fc is an alias for Format-Custom.
  • git diff --no-index works on any two files, even outside a Git repository, and adds word-level highlighting with --word-diff.
  • Many 'differences' are just line endings, trailing spaces or encoding, so use ignore-whitespace options before reading the results.
Watch the explainer
AI Automation for Law Firms, Explained Step by Step · 3:08 Subscribe

Quick comparison of methods

Method Platform Best for Shows word-level changes Data leaves your device
In-browser diff checker Any browser Quick checks, non-technical users Yes No, if it runs client-side
fc Windows Quick command-line checks No No
diff Mac, Linux Scripts and patches No (line-level) No
git diff --no-index Any OS with Git Readable, coloured diffs Yes, with --word-diff No
VS Code Windows, Mac, Linux Side-by-side code and config Yes No
Word / Google Docs compare Office, browser Documents with formatting Yes Google Docs: stored in your Google account
WinMerge / Meld Windows / Linux Folders and many files Yes No

1. Use an online diff checker that doesn't upload

For most people, this is the fastest option. Paste the original on the left, the new version on the right, and the tool highlights added, removed and changed lines.

Our free diff checker shows changes side by side or in a unified view, highlights the edited words inside each changed line, and can ignore whitespace and letter case. It uses the Myers difference algorithm, the same approach Git uses by default, and the comparison runs entirely in your browser. Nothing is uploaded or saved.

That last point matters more than it seems, so it gets its own section below.

2. Windows: the fc command

Windows has included a file compare command for decades. Open Command Prompt and run:

fc /n original.txt revised.txt

The /n switch adds line numbers. Useful options from Microsoft's fc documentation:

Switch What it does
/c Ignores letter case
/w Compresses runs of spaces and tabs, and ignores whitespace at the start and end of lines
/n Shows line numbers
/u Compares files as Unicode text
/b Binary comparison, byte by byte
/lb<n> Sets the line buffer; the default is 100 lines

A few quirks to know:

  • In PowerShell, type fc.exe. Microsoft notes that fc on its own is an alias for Format-Custom in PowerShell, so it won't do what you expect.
  • Very different files fail. If more than 100 consecutive lines differ, fc gives up with "Resynch failed. Files are too different." Raise the buffer with /lb or use another tool.
  • The exit code is scriptable. fc returns 0 when files are identical, 1 when they differ and 2 on error, which is handy in batch files.

PowerShell also has Compare-Object (Get-Content a.txt) (Get-Content b.txt). Be careful: it compares the files as collections of lines rather than in order, so it's good for "which lines are in one list but not the other" and poor for reading edits to a document.

3. Mac and Linux: diff

Every Mac and Linux machine has diff. The unified format is the most readable:

diff -u original.txt revised.txt

Helpful flags:

  • -y shows the files side by side.
  • -i ignores case.
  • -w ignores all whitespace, and -b ignores changes in the amount of whitespace.
  • -B ignores blank lines.
  • -r compares two folders recursively.
  • -q just reports whether files differ.

For binary files, cmp reports the first differing byte. For two sorted lists, such as mailing lists exported at different dates, comm shows lines unique to each file and lines in both.

Reading unified diff output

--- original.txt
+++ revised.txt
@@ -2,3 +2,3 @@
 Delivery within 5 working days.
-Returns accepted within 14 days.
+Returns accepted within 30 days.
 Prices include VAT.
  • --- and +++ name the old and new files.
  • @@ -2,3 +2,3 @@ means "starting at line 2, 3 lines from the old file and 3 lines from the new".
  • Lines starting with - were removed, + were added, and a space means unchanged context.

The same format is used by Git, code review tools and most patch files, so it's worth learning once.

4. git diff --no-index (works outside a repository)

If you have Git installed, you have one of the best diff tools available, even for files that have nothing to do with code:

git diff --no-index original.txt revised.txt

The git diff documentation describes --no-index as comparing "the given two paths on the filesystem", and it works outside any repository. You get coloured output and these useful extras:

  • --word-diff shows changes word by word, marking removals as [-old-] and additions as {+new+}. Brilliant for prose, where one changed word otherwise flags a whole paragraph.
  • --color-words highlights changed words using colour only.
  • -w ignores whitespace differences.
  • Two folders work too: git diff --no-index folder-a folder-b.

It exits with 1 when differences are found, so it also works in scripts.

5. VS Code: side-by-side comparison

Visual Studio Code, which is free, has an excellent built-in diff viewer:

  1. Open the folder containing both files, or drag them into VS Code.
  2. In the Explorer, right-click the first file and choose Select for Compare.
  3. Right-click the second file and choose Compare with Selected.

You can also run code --diff original.txt revised.txt from a terminal. VS Code highlights changed characters within lines, lets you edit either side directly, and has an option to ignore trailing whitespace. It's the best choice for config files, code, JSON and CSV exports.

For JSON, format both files consistently first, otherwise indentation differences swamp the real changes. Our JSON formatter does this, and our guide to JSON formatting and validation explains why key order and spacing cause noisy diffs.

6. Word and Google Docs: compare documents

Plain-text tools ignore formatting, which is fine for code but not for contracts or policies. Document tools compare the formatted text instead:

  • Microsoft Word: Review > Compare > Compare, choose the original and revised documents, and Word produces a new document showing every change as tracked changes.
  • Google Docs: Tools > Compare documents, choose the other document from your Drive, and Google creates a comparison document with suggested edits.

This is the right method when someone returns a document without tracked changes on, and you need to see what they altered. Law firms and accountants do this constantly. Our page of free tools for solicitors and law firms collects other checks useful for client-facing work.

7. WinMerge, Meld and folder comparisons

For comparing whole folders, such as two copies of a website or two backup sets, a dedicated desktop tool is easier:

  • WinMerge (Windows, free and open source) compares files and folders side by side and can merge changes.
  • Meld (Linux, with a Windows version too) does the same, including a three-way view.

If you only need to know whether two large files are identical, not what changed, compare their hashes instead. If the SHA-256 hashes match, the files are identical. Our hash generator does this in the browser, and MD5 vs SHA-256 explains which hash to trust.

Avoiding false differences

Often a diff tool reports that every single line has changed, but the text looks identical. These are the usual culprits:

  1. Line endings. Windows uses CRLF (\r\n), while Mac and Linux use LF (\n). A file saved on each will differ on every line. Most tools have an option to ignore line endings, or you can convert both in your editor.
  2. Trailing spaces and tabs. Invisible but real. Use "ignore whitespace", /w, -w or -b.
  3. Encoding and byte order marks. A file saved as UTF-8 with a BOM has three extra bytes at the start, and a file saved in Windows-1252 shows £ differently. Save both as UTF-8.
  4. Smart quotes and dashes. Word changes " to “ and - to –. Text copied from documents often differs from text typed in an editor.
  5. Letter case. Use the ignore-case option if case doesn't matter, or normalise both with a case converter.
  6. Line wrapping. If one version has hard line breaks every 80 characters and the other doesn't, a line diff is useless. Use a word-level diff instead.
  7. Ordering. Two exports of the same list in a different order look completely different. Sort both first, or use comm or Compare-Object for set comparisons.

Privacy: where does your text go?

When you paste text into a website, it can go to one of two places:

  • Client-side tools process the text with JavaScript in your browser. Nothing is sent to a server.
  • Server-side tools upload both texts to the provider's server, compare them there and send back the result. The provider may log or store what you pasted, and some publish shareable links to diffs by default.

For a shopping list, it doesn't matter. For a contract, an employment letter, a customer export or anything containing personal data, it does. Under UK and EU GDPR (and similar privacy laws elsewhere, such as US state laws like the CCPA), uploading personal data to a third-party service means sharing it with that organisation, and you'd normally need to know who they are, where they process the data and on what terms. The UK ICO's guidance on controllers and processors explains the responsibilities.

How to tell if a tool is client-side:

  1. Check its privacy notice or FAQ for a clear statement that nothing is uploaded.
  2. Load the page, then disconnect from the internet and try a comparison. If it still works, it's running locally.
  3. Open your browser's developer tools, go to the Network tab and watch for requests when you click compare.

When in doubt, use one of the offline methods above. They're all free.

Everyday uses for comparing files

  • Contracts and terms: check what a client or supplier changed before you sign.
  • Website copy: compare the old and new version of a page before publishing. A word counter helps if there are length limits.
  • robots.txt and redirects: compare the live file with your edited version before uploading. Then test the rules before they go live.
  • Price lists and product feeds: spot changed prices or missing products between two exports. Converting both to JSON with the CSV to JSON converter can make structured comparisons cleaner.
  • Config files: see what changed between a working and a broken setup.
  • Mailing lists: find who was added or removed between two exports.

If your team compares the same reports or exports every week by hand, that's a process worth automating. Make It Flow can set up a workflow that compares files on a schedule and flags only the changes that need a person's attention. Talk to us if that sounds useful.

FAQ

How do I compare two text files for differences?

Paste both into an in-browser diff checker, which highlights added, removed and changed lines. Alternatively, run fc file1.txt file2.txt in Windows Command Prompt, diff -u file1.txt file2.txt on Mac or Linux, or git diff --no-index file1.txt file2.txt anywhere Git is installed. VS Code also compares files side by side.

Does Windows have a built-in file compare tool?

Yes. The fc command in Command Prompt compares two text or binary files and lists the differences. Use /n for line numbers, /c to ignore case and /w to ignore whitespace. In PowerShell, type fc.exe, because fc alone is an alias for Format-Custom. For a visual tool, install VS Code or WinMerge.

How do I compare two files in Notepad++?

Notepad++ doesn't compare files out of the box, but the free Compare plugin adds it. Install it from Plugins > Plugins Admin, open both files, then choose Plugins > Compare > Compare. It shows the files side by side with changes highlighted. VS Code offers similar comparison without any plugin.

Why does my diff show every line as changed?

Usually because of invisible differences: Windows (CRLF) versus Mac and Linux (LF) line endings, trailing spaces, a different text encoding or a byte order mark. Turn on the tool's ignore-whitespace or ignore-line-ending option, or save both files as UTF-8 with the same line endings, then compare again.

Is it safe to compare confidential documents online?

Only with a tool that processes text in your browser rather than uploading it. Server-based tools send your text to someone else's server, where it may be logged or stored. For contracts or personal data, use a client-side tool or an offline method such as fc, diff, VS Code or Word's Compare feature.

How do I compare two Word documents?

In Word, go to Review > Compare > Compare, select the original and the revised document, and Word creates a new document showing every difference as tracked changes. In Google Docs, use Tools > Compare documents. Plain-text diff tools ignore formatting, so use these for documents where layout and styling matter.

#compare text files #diff checker #productivity #developer tools

More guides for your industry

Free checklist (PDF)

Free law firms website checklist

30 practical checks for law firms: website speed and mobile, Google Business Profile and reviews, email security, booking and enquiry handling, and AI search visibility. Each one says why it matters, and many link to a free tool that checks it.

We email you the PDF and nothing else unless you tick the box. See the privacy policy.

Written by the MakeItFlow team

We build the website audit these guides are based on. Every fact is checked against the primary sources listed above and this guide was last reviewed on 25 October 2026 . How we research and check

Share LinkedIn X Facebook WhatsApp

Check your own site in 30 seconds

Run a free audit covering speed, SEO, DNS, email authentication and security headers — and get a prioritised fix list.

Weekly newsletter

One practical website fix, every week

New guides on speed, SEO, email deliverability and security — straight to your inbox. No spam, unsubscribe in one click.

Keep reading