SHA-256 vs MD5
MD5 produces a 128-bit digest and SHA-256 a 256-bit one, but the real difference is that MD5 is broken. Collisions — two different inputs with the same digest — can be produced on a laptop in seconds, so MD5 cannot prove a file is unaltered. Use SHA-256 for anything security-related. MD5 remains acceptable only as a non-security checksum.
SHA-256 Hash Generator
Generate a SHA-256 digest — the modern default.
"Broken" has a precise meaning here, and it is worth being exact. MD5 is broken for collision resistance: an attacker can construct two different inputs that hash to the same value. It is not broken for preimage resistance — given a digest, recovering an input that produces it is still computationally infeasible.
That distinction explains why MD5 has not vanished. It is fatal wherever an attacker chooses the input, such as file signing or certificate issuance. It is largely irrelevant where you are only guarding against accidental corruption.
What collision resistance protects
If an attacker can find two files with the same digest, they can have a benign version signed or approved and then substitute the malicious one, since the checksum still matches. This is not theoretical: it has been used to forge certificates and to produce colliding executables and documents.
Practical differences
- Digest length: MD5 is 128 bits, 32 hex characters; SHA-256 is 256 bits, 64 hex characters.
- Collision resistance: MD5 broken since 2004; SHA-256 has no practical attack.
- Speed: MD5 is faster, which is a disadvantage for anything password-related.
- Status: MD5 is prohibited for security use by essentially every current standard.
Where MD5 is still acceptable
Where no attacker is choosing the input and you are only detecting accidental change: verifying a file copied across a flaky network, deduplicating your own files, or generating a cache key. Even then SHA-256 costs little more, so the main reason to keep MD5 is compatibility with a system you cannot change.
Neither belongs in password storage
This is the more common mistake. Both MD5 and SHA-256 are far too fast for storing passwords — a GPU computes billions per second, so a stolen database falls quickly. Password storage needs a deliberately slow, salted function: bcrypt, scrypt or Argon2.
Frequently asked questions
Is MD5 completely useless now?
Can MD5 be reversed?
Is SHA-1 any better?
Why is MD5 still everywhere?
Which should I use to verify a download?
Tools used in this guide
All tools →- SHA-256 Hash Generator Generate a SHA-256 digest — the modern default. In your browser
- MD5 Hash Generator Generate an MD5 checksum from any text. In your browser
- Hash Generator Generate MD5, SHA-1, SHA-256 and SHA-512 digests at once. In your browser
- SHA-512 Hash Generator Generate a 512-bit SHA-2 digest. In your browser
- Bcrypt Generator and Verifier Create and verify bcrypt password hashes. Server-side
Related guides
All guides →- SHA-256 vs SHA-512 Both are secure. Which to pick depends on hardware and interoperability, not strength.
- How to Hash Text with SHA-256 Produce a SHA-256 digest, compare it against a published checksum, and know when SHA-256 is the wrong tool.
- Base64 vs Encryption Base64 is an encoding, not a cipher. What it is actually for, and why it protects nothing.
Last reviewed .