How do I get the MD5 of a file on Windows?

Single file: Look the answer below me.

All .jpg files in current directory:

forfiles /s /m *.jpg /c "cmd /c CertUtil -hashfile @path MD5"


There's a built-in PowerShell tool:

CertUtil -hashfile yourFileName MD5

The following rules are as of Windows 7 SP1, Windows Server 2012, and beyond. If they are known to work in older versions, they will be noted with: (independent of Windows version)

  • You will need to open a Command Prompt OR Powershell to run this command
    ** a quick guide to open CMD/Powershell is at the bottom of the answer

  • You can find the checksum for a file using ANY of the following hashing algorithms, not JUST MD5:

     MD2 MD4 MD5 SHA1 SHA256 SHA384 SHA512
    
  • To get the current list of supported Hash Algorithms on your specific windows machine (independent of Windows version), run

     CertUtil -hashfile -?
    
  • The full Format is below, optional parameters are in braces - just replace [HashAlgorithm] with your desired hash from above:

     CertUtil -hashfile InFile [HashAlgorithm]
    
  • You can do the command line operation for ANY files, whether they provide a certificate or not (independent of Windows version)

  • If you leave off the [HashAlgorithm], it will default to the SHA1 checksum of your chosen file

  • Its HELPFUL to note that [HashAlgorithm] is case INsensitive in both CMD and Powershell meaning you can do any of the following (for example):

     CertUtil -hashfile md5
     certutil -hashfile MD5
     CertUtil -hashfile sHa1
     certutil -hashfile SHA256
    

Quick: How to Open Command Prompt or Powershell

In case you do not know how to open the Command Prompt or Powershell and you got here by search engine, the following is a quick guide that will work for Windows XP and beyond:

  1. Press [Windows]+[R]
  2. Then, type cmd (or powershell if Windows 8+)
  3. Press [OK] or hit enter

Open a powershell window and try the following command:

Get-FileHash {filename} -Algorithm MD5

Substituting {filename} with the path to your file, e.g.

Get-FileHash c:\example.txt -Algorithm MD5

More information on this can be found in the docs for Get-FileHash.