Step by step
- Select two files in the Explorer.
- Right-click › Compare Selected.
- Or: code --diff a.txt b.txt in a terminal.
At a glance
| Method | Where | Good for |
|---|---|---|
| Compare Selected | Explorer right-click | Two files in the project |
| Compare with Clipboard | Command palette | Open file vs copied text |
| code --diff | Terminal | Any two files |
Related questions
How do I switch to inline view?
Use the diff editor's ⋯ menu or settings to toggle side by side or inline.
Can VS Code ignore whitespace?
Yes, the diff editor has an option to ignore trim whitespace.
Can I compare two unsaved snippets?
Open two Untitled files and compare them, or paste them into the boxes above.
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 text while ignoring spaces and case
- How to compare two text files on Windows 11
- How to compare two text files on a Mac
- 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.