Free Tools
Blog

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

By Admin Editor · September 28, 2026

Download pages list checksums like MD5: 9e107d9d... or SHA-256: d7a8fbb3.... APIs sign requests with "HMAC-SHA256". Old tutorials still hash passwords with MD5. They're all hash functions — but they're not interchangeable.

A laptop on a desk, used for downloading and checking files

What a hash function does

A hash function turns any input — a word, a file, a 4 GB disk image — into a short fixed-length fingerprint. The same input always gives the same hash, and changing even one character changes the output completely. You can't reverse a hash back into the original data.

The important security property is collision resistance: it should be practically impossible to find two different inputs with the same hash.

The algorithms compared

Algorithm Output Hex length Status
MD5 128 bits 32 characters Broken for security
SHA-1 160 bits 40 characters Broken for security
SHA-256 256 bits 64 characters Secure, the modern default
SHA-384 384 bits 96 characters Secure
SHA-512 512 bits 128 characters Secure

MD5

Fast and everywhere, but researchers showed practical collisions back in 2004, and attackers have since used MD5 collisions to forge certificates. Fine for: spotting accidental corruption, deduplicating files, cache keys. Not fine for: anything an attacker might tamper with.

SHA-1

Longer than MD5 and survived longer, but in 2017 Google and CWI Amsterdam published two different PDF files with the same SHA-1 hash. Browsers and certificate authorities have dropped it. Treat it like MD5: OK for non-security checksums, nothing else.

SHA-256

Part of the SHA-2 family and the standard choice today. It's used for software downloads, TLS certificates, Git's newer object format, and blockchains. No practical collision attack is known. If you're unsure, use SHA-256.

SHA-384 and SHA-512

Also SHA-2, with longer outputs. SHA-512 can be faster than SHA-256 on 64-bit processors. Use them when a standard or system asks for them; for most checksums SHA-256 is plenty.

An illuminated security keypad on a wall

Why none of these should store passwords

MD5 and the SHA family are designed to be fast — a modern GPU can compute billions of them per second. That's exactly what a password cracker wants. Passwords need a deliberately slow, salted algorithm such as Argon2, bcrypt or scrypt. A plain SHA-256 of a password isn't safe storage.

How to generate and compare hashes

  1. Open the free Hash Generator.
  2. Type or paste text, or choose a file.
  3. You get MD5, SHA-1, SHA-256, SHA-384 and SHA-512 at once.
  4. To verify a download, paste the publisher's checksum next to yours and compare.

Hashing runs entirely in your browser, so files and text are never uploaded.

FAQ

Is a longer hash always better? For security, beyond SHA-256 the difference rarely matters. Compatibility matters more.

Can two files have the same SHA-256? In theory yes, but nobody has ever found such a pair.

Try it now

Compare all five with the free Hash Generator.

Related reading

See What Is a Hash and How to Verify a File With SHA-256 and How Strong Is Your Password?