MD5 Sums: Verify Downloaded Files
In this article
MD5 checksums let you confirm that a downloaded file is exactly what the publisher intended, catching corrupted downloads and tampered files. You compare the checksum shown on the download page with the one you compute locally; if they match, the file is intact. You'll need a terminal or command prompt, and the file you want to verify.
What You'll Need
- A downloaded file you want to verify.
- The official MD5 checksum from the publisher's website (usually listed next to the download link).
- Access to a terminal (macOS/Linux) or command prompt (Windows). On Windows 10/11, PowerShell is built-in; on macOS/Linux, the terminal app is standard.
Step-by-Step
- Locate the official MD5 checksum. Go to the website where you downloaded the file. Look for a string of 32 hexadecimal characters (0-9 and a-f) labeled "MD5," "Checksum," or "File Hash." Copy it exactly, including any lowercase letters.
- Open your terminal or command prompt.
- Windows: Press Win, type "PowerShell," and press Enter.
- macOS: Open Finder, go to Applications > Utilities, and double-click Terminal.
- Linux: Press Ctrl+Alt+T or open your terminal app from the applications menu.
- Navigate to the folder containing the downloaded file. Use the
cdcommand. For example, if your file is in Downloads:cd ~/Downloads
On Windows PowerShell, use:cd $HOME\Downloads
- Run the MD5 command on the file.
- Windows PowerShell: Type
Get-FileHash -Algorithm MD5 -Path "filename.ext"and press Enter. Replacefilename.extwith your actual file name. - macOS/Linux: Type
md5 filename.ext(on macOS) ormd5sum filename.ext(on Linux) and press Enter.
setup.exein the current folder:md5sum setup.exe
- Windows PowerShell: Type
- Compare the output with the official checksum. The command will print a 32-character hexadecimal string. Compare it character by character with the one from the website. They should be identical.
- Interpret the result.
- Match: The file is authentic and undamaged. Proceed with installation or use.
- Mismatch: The file is corrupted or has been altered. Do not use it. Delete it and download again from the official source.
Common Mistakes
- Mixing up MD5 with SHA-1 or SHA-256. These are different algorithms and produce different strings. Make sure you are using MD5 on both sides.
- Copying the checksum with extra spaces or line breaks. Even a single space will cause a mismatch. Copy carefully and avoid adding any characters.
- Checking the wrong file. If you have multiple versions of the same file (e.g.,
setup(1).exe), you might be checking the wrong one. Verify the file name exactly. - Using the wrong path. If the terminal says "No such file or directory," you are not in the right folder or the file name is misspelled. Use
ls(Linux/macOS) ordir(Windows) to list files. - Assuming all websites use MD5. Many now use SHA-256. If the site only provides SHA-256, use that instead (the commands are similar:
Get-FileHashwithout-Algorithmon Windows,shasum -a 256on macOS,sha256sumon Linux).
Tips
- Use a checksum comparison tool. Instead of eyeballing, copy both strings into a text editor and use a diff tool, or use an online string comparison site (but be careful with sensitive files).
- Check the official source. Always get the checksum from the official website, not from a mirror or a forum post, as those could be tampered with.
- Automate with a script. If you verify many files, write a small script that compares the output automatically and prints "OK" or "MISMATCH."
- Know that MD5 is not cryptographically secure. It is still fine for checking accidental corruption, but if you are worried about a malicious attacker, use SHA-256 or SHA-3.
Troubleshooting
- The command is not recognized. On Windows, if
Get-FileHashis not found, you might be in Command Prompt instead of PowerShell. Typepowershelland press Enter, then try again. On Linux, ifmd5sumis missing, install it with your package manager (e.g.,sudo apt install coreutilson Debian/Ubuntu). - The output is longer than 32 characters. On Linux,
md5sumprints the hash followed by two spaces and the file name. Ignore everything after the first 32 characters. On Windows, the output is formatted but the hash is the first 32 characters. - The file name has spaces. Enclose the file name in quotes, e.g.,
md5sum "my file.iso". - You get a permission error. Make sure you have read access to the file. On Linux/macOS, if the file is in a protected folder, use
sudo(but be cautious). - The checksum still doesn't match after re-downloading. The file might be corrupted on the server, or the publisher might have updated the file without updating the checksum. Contact the publisher's support.
Frequently Asked Questions
What is an MD5 checksum?
An MD5 checksum is a 32-character hexadecimal string generated by running the MD5 algorithm on a file. It acts like a fingerprint; any change to the file, even a single bit, produces a completely different checksum.
Why should I verify a file's MD5?
To ensure the file you downloaded is exactly what the publisher released. This catches errors from interrupted downloads, corrupted storage, or malicious tampering.
Can MD5 be faked?
Yes, MD5 is cryptographically broken, meaning a determined attacker can create a different file with the same MD5 hash. For security-critical checks, use SHA-256 or SHA-3 instead.
What do I do if the checksum doesn't match?
Do not use the file. Delete it and download again from the official source. If it still fails, report the issue to the publisher.
Is MD5 the same as SHA-256?
No, they are different algorithms. MD5 produces a 128-bit hash (32 hex chars), while SHA-256 produces a 256-bit hash (64 hex chars). They are not interchangeable.
Can I verify an entire folder of files?
Yes, you can run the command on each file individually, or use a script to loop through them. Some tools like md5deep can do this recursively.