compare contents of two files in Visual Studio Code

How to compare contents of two files in Visual Studio Code?

Lately I got questions asking for a quick lightweight tool to compare code files. Even though there are several tools like Beyond Compare, Araxis Merge, etc… which have lot of comparison and merging features, I use Visual Studio Code for quick file comparison during development or otherwise. For me, VS Code comes in handy as it is cross platform and I am using it on both macOS and Windows. I am using it for minor project development and even as a simple text editor. So naturally VS code is my go-to tool for file comparison. Here are the simple steps to compare the contents of two code files in VS Code.

Steps to compare contents of two files

  1. Open both the files in VS Code.
  2. From the left Explorer panel, right-click the first file and choose Select for Compare from the right-click menu.
    Select a file to compare
  3. Then right-click the second file and choose Compare with Selected.
    Select another file to compare
  4. Both the files will be opened in the main panel, side by side in inline view mode which is comfortable for comparing the differences.
compare contents of two files in Visual Studio Code

Video Illustration

Reference

  • More about Visual Studio Code here.


Related Articles & Tools

Leave your thoughts...

This site uses Akismet to reduce spam. Learn how your comment data is processed.