In Intellij IDEA how to compare 2 text files that are not part of an open project

The following works for me in IntelliJ IDEA Ultimate 14.1.7 on Windows:

  1. Open the first file in the IDE (either by dragging from Windows Explorer into the window, or by File / Open).
  2. In the view menu, choose "Compare With…"
  3. In the "Select Path" dialog that appears, select the second file (either directly, or by dragging from Windows Explorer into the dialog).

It then opens up in the traditional file comparison pane. If you try to edit one of the files, it presents the usual "Are you sure you want to edit a file that's not in your project" dialog, which one can accept if that's what one is trying to do.


You can use the "compare with clipboard" feature.

From https://www.jetbrains.com/help/idea/2016.1/comparing-files.html#clipboard:

Comparing a File in the Editor with the Clipboard Contents

  1. Open the desired file in the editor.
  2. Right-click the editor pane and choose Compare with Clipboard on the context menu.
  3. View and manage differences in the Differences Viewer for Files.