textdiff

textdiff / Compare two text files

How to compare two text files

Fastest way: press Open file on each side below (or drop both files at once) and every difference is highlighted. Your files are read in your browser and never uploaded. Prefer a desktop tool? Instructions for Notepad++, VS Code, Windows and macOS/Linux follow.

0 chars · 0 lines
0 chars · 0 lines

Paste or drop two versions and the differences appear as you type. Removed text is struck through in red, added text underlined in green.

Compare two text files online

  1. Press Open file above the left box and choose the older file; do the same on the right for the newer one. You can also drag both files onto the page together.
  2. Leave Line selected for code, logs and data; switch to Word for prose.
  3. Read the highlights: red lines were removed, green lines were added. Prev / Next (or the n / p keys) jump between changes.
  4. Need a record? Download .diff saves a standard patch; Print / PDF saves the highlighted view.

Works with .txt, .csv, .log, .md, .json, .xml, source code, Word .docx and PDFs with selectable text, up to 20 MB per file. For spreadsheets keyed by an ID column, use Excel compare or CSV compare; for two lists in any order, compare lists.

Compare two files in Notepad++

  1. Open Plugins › Plugins Admin, search for Compare, tick it and press Install. Notepad++ restarts.
  2. Open both files, each in its own tab.
  3. Choose Plugins › Compare › Compare. The files appear side by side with added, removed and changed lines marked.
  4. Plugins › Compare › Clear Active Compare returns to normal editing.

Compare two files in VS Code

In the Explorer, right-click the first file and choose Select for Compare, then right-click the second and choose Compare with Selected. Or select both, right-click, Compare Selected. From a terminal: code --diff old.txt new.txt.

Compare two files from the command line

SystemCommandWhat it shows
Windows (CMD)fc old.txt new.txtBlocks of lines that differ
Windows (PowerShell)Compare-Object (Get-Content old.txt) (Get-Content new.txt)Lines only in one file (<= / =>)
macOS / Linuxdiff -u old.txt new.txtUnified diff, like this site's download
Any OS with gitgit diff --no-index --word-diff old.txt new.txtChanged words, coloured
Identical or not?cmp a b or fc /b a bFirst differing byte, or nothing if equal

Got a .diff file from one of these commands? Paste it into the diff viewer to read it with colours and line numbers.

Comparing Word documents and PDFs

Word has its own tool under Review › Compare › Compare Documents, which also tracks formatting. If you only care about the wording, or you don't have Word, compare documents extracts the text of two .docx files in your browser and diffs it word by word. Two PDFs go through compare PDF.

Questions

How can I compare two text files for differences?

The quickest way is to open both files in an online diff tool such as the one at the top of this page: press Open file on each side (or drop both files at once) and the differences are highlighted immediately. On your own computer you can use VS Code ("Compare Selected"), Notepad++ with the Compare plugin, fc on Windows or diff on macOS and Linux.

Can Notepad++ compare two files?

Not out of the box. Install the free "Compare" plugin from Plugins > Plugins Admin, open both files in separate tabs, then choose Plugins > Compare > Compare (Ctrl+Alt+C in recent versions of the plugin). Differences are marked in the margins of both tabs.

How do I check if two files are exactly the same?

Open them in the diff tool above: "No differences" means they match character for character. On the command line, fc /b file1 file2 (Windows), cmp file1 file2 (macOS/Linux) or comparing checksums such as certutil -hashfile file SHA256 or shasum -a 256 file gives the same answer for any file type.

Can I use git diff to compare two files that are not in a repository?

Yes. git diff --no-index old.txt new.txt compares any two files on disk, even outside a git repository, and prints a unified diff. Add --word-diff to see changed words instead of whole lines.

What is the best tool for comparing files?

It depends on the job. For a one-off check, a browser tool needs nothing installed. For daily code work, the diff built into your editor (VS Code, JetBrains IDEs) is most convenient. For whole folders, a desktop tool such as WinMerge (free, Windows) or Beyond Compare (paid) handles directory trees, which browser tools cannot.

Are my files uploaded when I compare them here?

No. textdiff reads both files with JavaScript in your browser and compares them there. Nothing is sent to a server unless you press the optional AI summary button.