How to verify a file with an MD5 checksum
Learn what an MD5 checksum is and how to verify a file in minutes. Follow plain steps to compare MD5 values and lower collision risk.
Contents
Verifying a file with an MD5 checksum confirms that the file is complete and unaltered. An MD5 checksum is a 32-character string computed from the file's contents using the MD5 hashing algorithm. When you compute the checksum of the file you received and compare it to the checksum provided by the source, a match tells you the file is likely intact. This process applies to any file, from software installers to family record archives.
What an MD5 Checksum Shows
An MD5 checksum is a digital fingerprint of a file. The md5sum command or similar tool reads the whole file and calculates a 32-character MD5 hash. If the file changes by even one bit, the hash changes completely. Comparing MD5 values from the source and your copy detects accidental damage during download or storage. Due to known MD5 collision risk, the method is not suitable for security against deliberate tampering.
Using the md5sum Command
The md5sum command is available on most Linux and macOS systems, and free tools exist for Windows. Open a terminal in the folder holding your file and type 'md5sum filename' followed by the Enter key. The command outputs the MD5 hash and the file name. On Windows, you can use a utility or the built-in Get-FileHash cmdlet in PowerShell. The hash appears in lowercase hexadecimal characters.
Comparing MD5 Values Safely
Download verification means checking your computed hash against the expected value. The provider may list the checksum on the download page or in a separate .md5 file. Compare the strings character by character, or use a tool to do it. A mismatch means the download is corrupt or incomplete and you should obtain the file again. Because collision attacks exist, do not rely on MD5 alone to prove authenticity of a critical file.
Common MD5 Checksum Questions
What is an MD5 checksum used for?
An MD5 checksum verifies that a file has not changed. It is often used to confirm that a downloaded file arrived without errors. The checksum allows you to compare the file's current state to its original state. It does not encrypt the file or hide its contents.
Is MD5 still safe to use?
MD5 is considered unsafe for cryptographic security because researchers can create collisions. However, it remains useful for detecting accidental file corruption. For important downloads, you may prefer a stronger hash function. MD5 checksum verification still gives a quick sanity check.
How do I run md5sum on Windows?
Windows does not include the md5sum command by default, but you can use PowerShell. Open PowerShell and type 'Get-FileHash -Algorithm MD5 filename' to get the hash. You can also download a small standalone md5sum utility. The command or utility will show a hash for comparison.
What if the checksums do not match?
A mismatch means the file on your system differs from the expected file. You should not use the file until you obtain a correct copy. Download the file again from the source and compare once more. If the problem repeats, contact the provider.