How to compare two files with Command Prompt on Windows 11 and 10

Windows 11 FC command to compare files
(Image credit: Mauro Huculak)

On Windows 11 (and 10), the File Compare (fc) is a command-line tool that comes part of the system, and it allows you to compare two similar files to determine how they changed over time. Usually, "fc" will be helpful for comparing simple text files, determining the changes made to a script, detecting if a file has been modified, and similar scenarios.

The tool can compare two similar files or the newest version against all the other files in the same location. Also, it includes options to examine the changes at the text level, or in Unicode, ASCII, or binary mode.

In this how-to guide, you will learn steps to use the tool to compare files with Command Prompt on Windows 11 as well as on Windows 10.

Recent updates

This guide has been updated to ensure the instructions are still accurate and reflect you can also use the tool on Windows 11.

How to compare files with the fc command on Windows 11

To compare files with the fc command tool, use these steps:

  1. Open Start.
  2. Search for Command Prompt, right-click the top result, and select the Run as administrator option.
  3. Type the following command to browse to the folder with the files you want to compare and press Enter: cd PATH\TO\FILES

In the command, update the path with the location of the folder with the files to compare. This example navigates to the Downloads folder: cd C:\Users\USERACCOUNT\Downloads

  1. Type the following command to compare two similar files and press Enter: fc filename1.txt filename2.txt

In the command, replace filename1.txt and filename2.txt for the name of the files you want to compare.

(Image credit: Mauro Huculak)
  1. Type the following command to compare two similar files in ASCII mode and press Enter: fc /L filename1.txt filename2.txt
  2. Type the following command to compare two files displaying only the first line that is different and press Enter: fc /a filename1.txt filename2.txt

(Image credit: Mauro Huculak)
  1. Type the following command to compare two files in Unicode mode and press Enter: fc /u filename1.txt filename2.txt

(Image credit: Mauro Huculak)
  1. Type the following command to compare two files in binary mode and press Enter: fc /b filename1.txt filename2.txt

(Image credit: Mauro Huculak)
  1. Type the following command to compare all the files (*.txt) in the same folder to the new file (filename2.txt) and press Enter: fc *.txt filename2.txt

(Image credit: Mauro Huculak)
  1. Type the following command to compare two files in different locations and press Enter: fc DRIVE:\PATH\TO\filename1.txt DRIVE:\PATH\TO\filename2.txt

In the command, replace DRIVE for the storage location drive letter and \PATH\TO\filename1.txt and \PATH\TO\filename2.txt with the path and name of the files you want to compare.This example compares two files in different folders: fc C:\Users\USERACCOUNT\Downloads\filename1.txt C:\Users\USERACCOUNT\Downloads\new\filename2.txt

(Image credit: Mauro Huculak)
  1. Confirm the output to see the difference between the files.
  • Quick tip: You can view the list of options and more examples using the fc /? command.

Once you complete the steps, you will be able to see the difference between two similar files.

While the tool allows you to compare files, remember that this is a basic tool meant to be used with text files and extensions like .exe, .com, .sys, .obj, .lib, or .bin. You may be able to compare files like those from Microsoft Office or images, but you can only compare them at the binary level.

More resources

For more in-depth insights, troubleshooting tips, and the latest updates on Windows 11 and 10, be sure to explore these resources:

Mauro Huculak

Mauro Huculak has been a Windows How-To Expert contributor for WindowsCentral.com for nearly a decade and has over 15 years of experience writing comprehensive guides. He also has an IT background and has achieved different professional certifications from Microsoft, Cisco, VMware, and CompTIA. He has been recognized as a Microsoft MVP for many years.