keptlocal
· 4 min read · UtilityDeveloper

MD5 vs. SHA-256: Which Hash Should You Use?

HP
Hitendra Patel
Founder, keptlocal · Senior Technical Lead, Healthcare IT

"Just use a hash" is common advice that skips the actual question: which one, and why. The answer depends entirely on whether you're defending against an adversary or just checking for accidental corruption — and conflating the two is how outdated hash choices end up in places they shouldn't be.

Generate any of them in your browser (free, instant)

The Hash Generator on keptlocal computes MD5, SHA-1, SHA-256, SHA-384, and SHA-512 simultaneously as you type, entirely in your browser.

The short answer

Default to SHA-256 unless you have a specific reason not to. It's fast, universally supported, has no known practical collision weakness, and is what most modern systems (Git's newer object format, TLS certificates, package manager checksums) have standardized on. The rest of this comes down to when the older algorithms are still legitimately fine to use.

What "broken" actually means here

Both MD5 and SHA-1 are broken in a specific, technical sense: researchers demonstrated practical methods to construct two different files that produce the identical hash — a "collision." That capability matters enormously if a hash is being used to prove a file hasn't been tampered with by someone who might want to trick you (a malicious download disguised as a legitimate one, a forged digital signature). It matters far less if you're just checking whether a file got corrupted during an ordinary transfer, or deduplicating files in your own storage — nobody is trying to deliberately engineer a matching hash in that scenario.

When each one still makes sense

  • MD5 — legacy checksum verification (older software mirrors still publish MD5 sums), quick internal deduplication, matching against systems that only accept MD5. Never for anything where a malicious actor might try to forge a match.
  • SHA-1 — largely superseded, though still present internally in older Git repositories. New projects should not choose it deliberately.
  • SHA-256 — the default choice for almost everything in 2026: file integrity checks, package manager lockfiles, TLS certificate fingerprints, Bitcoin's proof-of-work, general application use.
  • SHA-384 / SHA-512 — used where a system specifically calls for a larger digest, often for marginal extra cryptographic headroom; functionally similar to SHA-256 for most practical purposes.

The one thing none of these should be used for

Password storage. This is worth repeating because it's a common and serious mistake: general-purpose hash functions (MD5, SHA-1, SHA-256, and friends) are deliberately fast — designed to hash gigabytes of data quickly. That speed is a liability for password storage specifically, because it makes brute-forcing a stolen password database computationally cheap. Password storage needs a function designed to be slow and resource-intensive on purpose, with built-in per-password salting: bcrypt, scrypt, or Argon2 (the current recommended default). If you're building anything that stores user credentials, this is the one place where "just use SHA-256" is actively bad advice.

Privacy: what happens to your input

Every algorithm runs locally — SHA-family hashes through the browser's native Web Crypto API, MD5 through a small local JavaScript implementation. Nothing you type is transmitted anywhere.

Generate any of these hashes now with keptlocal's free Hash Generator — no upload, no signup.

Frequently asked questions

Is MD5 completely useless now?
No — it's useless against a deliberate adversary trying to forge a matching file, but it's still fine for accidental-corruption checks, deduplication, and matching against legacy systems that only support MD5. The distinction is adversarial vs. non-adversarial use.
What actually broke in MD5 and SHA-1?
Researchers found practical methods to construct two different inputs that hash to the same output (a "collision") — for MD5 in 2004, for SHA-1 in a 2017 demonstration by Google and CWI Amsterdam. That means someone can deliberately craft a malicious file with the same hash as a legitimate one, undermining any use case where the hash is meant to prove authenticity against an attacker.
Is SHA-256 itself guaranteed safe forever?
No hash function is proven unbreakable — only unbroken so far, given current cryptanalysis. SHA-256 has no known practical collision attack as of 2026 and is part of the well-studied SHA-2 family, which is why it's the current safe default. Cryptographic best practice is to plan for eventual migration, not assume permanence.
Should I use SHA-256 for hashing passwords?
No — use bcrypt, scrypt, or Argon2 instead. SHA-256 is fast by design, which is good for checksums and bad for password storage, since speed is exactly what makes brute-forcing a stolen password database cheap.
What about SHA-3?
SHA-3, standardized in 2015, uses a different internal structure (Keccak) than SHA-1/SHA-2 as a hedge against any future attack that might affect the whole SHA-2 family. It's not in widespread default use yet, and SHA-256 remains the practical default for most applications in 2026.
Free browser tool
Hash Generator

Generate MD5, SHA-1, SHA-256, SHA-384, and SHA-512 hashes — free, in your browser.

No upload. No signup. Runs in your browser.

Use Hash Generator