Compare two text files online
- 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.
- Leave Line selected for code, logs and data; switch to Word for prose.
- Read the highlights: red lines were removed, green lines were added. Prev / Next (or the n / p keys) jump between changes.
- 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++
- Open Plugins › Plugins Admin, search for Compare, tick it and press Install. Notepad++ restarts.
- Open both files, each in its own tab.
- Choose Plugins › Compare › Compare. The files appear side by side with added, removed and changed lines marked.
- 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
| System | Command | What it shows |
|---|---|---|
| Windows (CMD) | fc old.txt new.txt | Blocks of lines that differ |
| Windows (PowerShell) | Compare-Object (Get-Content old.txt) (Get-Content new.txt) | Lines only in one file (<= / =>) |
| macOS / Linux | diff -u old.txt new.txt | Unified diff, like this site's download |
| Any OS with git | git diff --no-index --word-diff old.txt new.txt | Changed words, coloured |
| Identical or not? | cmp a b or fc /b a b | First 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.