md5check

Is MD5 still safe?

The honest answer is "for what?" MD5 is broken as a collision-resistant function and still fine as a checksum against accidental corruption. Conflating those two things is how people end up either paranoid about nothing or quietly insecure.

Updated October 2026 8 min read Level: intermediate

Three different attacks, three different verdicts

"MD5 is broken" gets repeated without the qualifier. What actually broke is one specific property. The others are intact, and the difference determines whether MD5 is acceptable for your use.

Preimage attack: still infeasible

Given a digest, find any input that produces it. The best known attacks against full MD5 are barely faster than brute force, which is 2¹²⁸ work. Nobody has reversed an arbitrary MD5 hash of a long, high-entropy input, and nobody will.

This is why "MD5 is reversible, look it up online" is misleading. Those sites are not reversing anything — they are matching your hash against a table of hashes of common passwords. If the input was a 12-character random string, the table has nothing.

Second-preimage attack: weakened, not practical

Given one specific input, find a different input with the same digest. Published attacks reduce the work factor but not enough to be practical against a real file you were handed.

Collision attack: broken, and cheap

Find any two inputs with the same digest. This is trivially achievable. A collision in MD5 can be generated in seconds on ordinary hardware using published tools, and chosen-prefix collisions — where the attacker controls the content of both files — take minutes to hours on a GPU cluster.

Chosen-prefix is the one that matters, because it defeats the natural objection "but the attacker cannot control what I hash". They do not need to. They can build two documents that both start with the content they want, only one of which contains a hidden payload, and get both to the same MD5.

What a collision lets an attacker do

  1. Prepare two files with the same MD5. One is benign, one is not.
  2. Get the benign one hashed, signed, or approved by someone with authority — a CA, a code-signing service, an auditor, a build pipeline.
  3. Swap in the malicious file, which still matches the hash and therefore still matches the signature.

This is not hypothetical. It produced a rogue certificate authority in 2008 and was used to forge a Microsoft code-signing certificate in 2012. Every one of those attacks relied on MD5 being used inside a signature.

Where MD5 is still fine

UseVerdictWhy
Detecting a corrupted download Fine No adversary. A bit flip cannot produce a colliding file by accident; random collisions are a 1-in-2¹²⁸ event.
Comparing an MD5 a vendor published Fine You are reproducing their value, not relying on collision resistance. Just do not treat a match as proof of authenticity.
Cache keys, deduplication, hash tables Fine The threat model has no attacker choosing inputs to collide.
An HMAC-MD5 signature required by an existing API Acceptable HMAC is not weakened by collision attacks on the underlying hash. Still, prefer HMAC-SHA-256 for anything new.
Detecting tampering by a motivated attacker No That is exactly the scenario collisions enable.
Digital signatures, certificates, code signing No Real-world forgeries have been built this way.
Password storage Dangerous Not because of collisions — because it is fast and unsalted, so it falls to brute force and rainbow tables.

The distinction that resolves the confusion

A checksum answers "did these bytes arrive intact?" A hash used in a security decision answers "could an attacker have made this look intact when it is not?" MD5 is fine for the first question and unsuitable for the second.

Most people asking "is MD5 still safe" are asking the first question about a download they just made. For them the answer is yes, with one caveat: the checksum has to come from a source that the attacker does not control. If the file and the checksum are both served from the same compromised host, neither MD5 nor SHA-256 will save you.

If you are stuck with MD5

Some systems cannot be migrated this quarter. Reasonable interim mitigations:

  • Publish SHA-256 alongside MD5. Costs nothing, lets everyone who can verify the stronger value do so.
  • Sign the checksum file. A GPG signature over the checksum file removes the "same server" problem regardless of which algorithm produced the digest.
  • Get it from a second channel. A different host, a release announcement, a package repository you already trust.
  • Never use MD5 inside a new signature scheme. Reproducing an existing one is different from designing a new one.
  • Keep MD5 out of password storage entirely. There is no configuration of MD5 that is acceptable for passwords.

Check what you actually have. If the value you were given is 64 characters, it is not MD5 at all. The hash identifier reads the format and tells you which algorithms are plausible.

What to use instead

  • Integrity of files you publish: SHA-256, plus a detached signature if authenticity matters.
  • Detecting corruption on your own disk: anything, including MD5 or CRC-32. Pick what your tooling supports.
  • Password storage: Argon2id with a per-user salt, then scrypt, then bcrypt. See password hashing.
  • Message authentication: HMAC-SHA-256, or Ed25519 if the verifier must not be able to forge.
  • Content addressing at scale: BLAKE3 or SHA-256; both are fast and unbroken.