Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

MD5 Sums: Verify Downloaded Files

· 5 min read · Home Tech

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

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

  1. 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.
  2. 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.
  3. Navigate to the folder containing the downloaded file. Use the cd command. For example, if your file is in Downloads:
    cd ~/Downloads
    On Windows PowerShell, use:
    cd $HOME\Downloads
  4. Run the MD5 command on the file.
    • Windows PowerShell: Type Get-FileHash -Algorithm MD5 -Path "filename.ext" and press Enter. Replace filename.ext with your actual file name.
    • macOS/Linux: Type md5 filename.ext (on macOS) or md5sum filename.ext (on Linux) and press Enter.
    For example, to check a file named setup.exe in the current folder:
    md5sum setup.exe
  5. 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.
  6. 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) or dir (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-FileHash without -Algorithm on Windows, shasum -a 256 on macOS, sha256sum on 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-FileHash is not found, you might be in Command Prompt instead of PowerShell. Type powershell and press Enter, then try again. On Linux, if md5sum is missing, install it with your package manager (e.g., sudo apt install coreutils on Debian/Ubuntu).
  • The output is longer than 32 characters. On Linux, md5sum prints 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.