How to Diff Two Files in VS Code
Published April 2025 · 3 min read
Method 1: Right-Click (Easiest)
- In the Explorer sidebar, right-click the first file
- Click "Select for Compare"
- Right-click the second file
- Click "Compare with Selected"
Method 2: Command Palette
- Open both files in tabs
- Press
Ctrl+Shift+P(orCmd+Shift+Pon Mac) - Type "Compare Active File With..."
- Select the other file
Method 3: Terminal
code --diff file1.js file2.jsCompare with Git Version
Click the file in Source Control sidebar to see changes vs last commit. Or use:
code --diff HEAD:file.js file.jsOnline Alternative
Use our Diff Checker for quick text comparison without VS Code.