Step by step
- Open Terminal and cd to the folder.
- Run diff -u a.txt b.txt.
- Or copy both texts into the boxes above.
At a glance
| Option | Command | Effect |
|---|---|---|
| Basic | diff a.txt b.txt | Shows differing lines |
| Unified view | diff -u a.txt b.txt | Changes with context |
| Ignore case and spaces | diff -iw a.txt b.txt | Fewer false differences |
Related questions
How do I get the file path into Terminal?
Drag the file from Finder into the Terminal window.
Is FileMerge free?
Yes, it comes with Xcode from the App Store.
Can diff compare folders?
Yes, diff -r folder1 folder2.
More questions: text compare
- How to compare two texts or documents in Word
- How to compare text in Excel
- How to compare text in two PDFs
- How to compare two files in Notepad++
- How to compare two files or texts in VS Code
- How to compare text while ignoring spaces and case
- How to compare two text files on Windows 11
- Text compare for large files and long documents
- How to compare two texts for similarity or copying
- How to compare code, SQL or CSV online safely
Updated November 14, 2026.