MD5 (Message-Digest Algorithm 5) is a hash function that produces a 128-bit (16-byte) digest, typically represented as a 32-character hexadecimal string. Originally designed for cryptographic use, MD5 is now considered broken for security purposes but remains widely used for non-cryptographic checksums.
How it works
MD5 processes input in 512-bit blocks through four rounds of operations, each consisting of 16 steps. The result is always a 128-bit hash, regardless of input size.
Input: "hello"
MD5: 5d41402abc4b2a76b9719d911017c592
Like all hash functions, MD5 is deterministic — the same input always produces the same output. Even a tiny change in the input produces a wildly different hash.
Why MD5 is broken
In 2004, researchers demonstrated practical collision attacks against MD5 — they could create two different inputs that produce the same hash. By 2008, researchers used MD5 collisions to forge a rogue SSL certificate. Today, generating MD5 collisions takes seconds on ordinary hardware.
This means MD5 cannot be trusted for:
- Digital signatures
- Certificate verification
- Password hashing
- Any security-sensitive application
Where MD5 is still used
Despite its cryptographic weaknesses, MD5 remains common for non-security purposes:
- File checksums: Verifying download integrity (when tampering isn’t a concern)
- Deduplication: Quickly identifying duplicate files
- Cache keys: Generating short, deterministic identifiers from longer strings
- ETags: Some web servers use MD5 for HTTP cache validation
- Legacy systems: Older databases and protocols still reference MD5 hashes
For these use cases, MD5’s speed and short output length are advantages. The collision weakness doesn’t matter when there’s no adversary trying to forge matching hashes.
Practical examples
In the terminal: echo -n "hello" | md5sum (Linux) or md5 -s "hello" (macOS). In Python: hashlib.md5(b"hello").hexdigest(). In JavaScript (Node.js): crypto.createHash('md5').update('hello').digest('hex').
Generate MD5 hashes with the MD5 Hash Generator or compare multiple algorithms side by side with the Hash Generator. Use the Hash Identifier to detect whether an unknown hash is MD5.