How to Check MD5 Checksum on Windows, Mac, and Linux
โ Back to Blog
How to Check MD5 Checksum on Windows, Mac, and Linux
ยท 5 min read
What Is an MD5 Checksum?
An MD5 checksum is the MD5 hash value of a file's content, used to verify file integrity. Software publishers typically provide file MD5 checksums alongside download pages; after downloading, you calculate the local file's MD5 and compare it โ if they match, the file is intact and uncorrupted.
Checking MD5 Checksum on Linux
# Calculate MD5 of a single file
md5sum filename.zip
# Output: d41d8cd98f00b204e9800998ecf8427e filename.zip
# Verify against a known hash
echo "d41d8cd98f00b204e9800998ecf8427e filename.zip" | md5sum -c
# Output: filename.zip: OK (or: FAILED)
# If publisher provides a .md5 file
md5sum -c filename.zip.md5
# Checks each file listed in the .md5 file
# Calculate MD5 for all files in directory
md5sum /path/to/directory/* > checksums.md5
md5sum -c checksums.md5 # Verify later
Checking MD5 Checksum on macOS
# Method 1: md5 command (macOS native)
md5 filename.zip
# Output: MD5 (filename.zip) = d41d8cd98f00b204e9800998ecf8427e
# Method 2: md5sum (from Homebrew coreutils)
brew install coreutils
gmd5sum filename.zip
# Method 3: openssl (built-in)
openssl md5 filename.zip
# Method 4: certutil (available via Homebrew)
# One-liner comparison
[ "$(md5 -q filename.zip)" = "expected_hash_here" ] && echo "OK" || echo "FAIL"
Checking MD5 Checksum on Windows
# PowerShell (Windows 7+): Get-FileHash
Get-FileHash filename.zip -Algorithm MD5
# One-liner comparison in PowerShell
$expected = "d41d8cd98f00b204e9800998ecf8427e"
$actual = (Get-FileHash filename.zip -Algorithm MD5).Hash.ToLower()
if ($expected -eq $actual) { Write-Host "MATCH - File OK" -ForegroundColor Green }
else { Write-Host "MISMATCH - File corrupted!" -ForegroundColor Red }
# Command Prompt (older Windows): certutil
certutil -hashfile filename.zip MD5
# Also supports: SHA1, SHA256, SHA384, SHA512
Batch Verifying Multiple Files
When verifying multiple files, there's usually a manifest file containing all file hashes (typically .md5 or checksums.txt). The format is one entry per line: hash value, two spaces, filename.
# checksums.md5 file format:
d41d8cd98f00b204e9800998ecf8427e file1.tar.gz
5d41402abc4b2a76b9719d911017c592 file2.tar.gz
b1946ac92492d2347c6235b4d2611184 file3.tar.gz
# Linux: verify all at once
md5sum -c checksums.md5
# file1.tar.gz: OK
# file2.tar.gz: OK
# file3.tar.gz: FAILED
# PowerShell batch verification script
Get-Content checksums.md5 | ForEach-Object {
$parts = $_ -split " "
$expected = $parts[0]
$file = $parts[1]
$actual = (Get-FileHash $file -Algorithm MD5).Hash.ToLower()
if ($expected -eq $actual) { "$file : OK" } else { "$file : FAILED" }
}
Common Issue: Why Hashes Don't Match
- Incomplete file download (network interruption followed by re-download may result in a partially complete file)
- Downloaded the wrong file version (official file updated but the checksum is for the old version)
- Copied hash value included extra spaces or newline characters
- Case inconsistency (F5 vs f5 are equivalent in MD5, but some comparisons may be case-sensitive)
- File corrupted during storage (disk failure, transfer error)
SHA256 vs MD5 Checksum: Which to Use?
For file integrity verification (detecting accidental corruption), MD5 is still effective and faster. For preventing intentional tampering, use SHA256 or stronger hashes. Modern software releases (like Linux ISOs, Docker images) typically provide both MD5 and SHA256 checksums โ recommend using SHA256 for verification to get higher security assurance.
Try the online tool now โ no installation, completely free.
Open Tool โ
Try the free tool now
Use Free Tool โ