Visual Studio Code Compare Two Files

Compare Two Files in Visual Studio Code

Select the files you want to compare in the open editors and right-click on one of them and select Compare Selected. The selected files can be also unsaved files. compare selected files

Compare Two Files with a Command

Open the command palette with Ctrl+Shift+P and type compare and select Compare Active File with... and select the file you want to compare with.

Launch Compare Two Files from shell

To launch Visual Studio Code from the shell with two files to compare, use the following command:

code --diff file1 file2
# or 
code -d file1 file2