SHA-256 vs SHA-1 vs MD5
Use SHA-256 for anything that has to be secure, such as signatures, certificates or checking that a download was not tampered with. MD5 and SHA-1 are broken for security because collisions can be produced on purpose, but they still work as quick checksums against accidental corruption. None of them is suitable for storing passwords: use a slow password hash such as Argon2 or bcrypt.

What does a hash do?
A hash function turns any input, a word or a 4 GB file, into a short fixed-length fingerprint called a digest. The same input always gives the same digest, and changing a single character changes the digest completely. You cannot get the input back from the digest. That makes hashes useful to check that two files are identical, that a download arrived intact, or that a message was not changed.
Side by side
| Algorithm | Digest | Hex length | Status |
|---|---|---|---|
| MD5 | 128 bits | 32 characters | Broken: collisions take seconds on a laptop |
| SHA-1 | 160 bits | 40 characters | Broken: first public collision in 2017 (SHAttered) |
| SHA-256 | 256 bits | 64 characters | Secure, the current default |
| SHA-512 | 512 bits | 128 characters | Secure, often faster than SHA-256 on 64-bit CPUs |
What "broken" means
A collision is two different inputs with the same digest. For MD5 and SHA-1, researchers can build such pairs deliberately, so an attacker can prepare a harmless file and a malicious one that share a fingerprint. This is why browsers stopped trusting SHA-1 certificates and why Git added SHA-256 repositories. Finding an input that matches a given digest you did not choose is still hard, but relying on that margin is not worth it when SHA-256 is free.
When are MD5 or SHA-1 still fine?
- Accidental corruption: comparing a backup copy with the original, or spotting a truncated download, where nobody is trying to fool you.
- Cache keys and deduplication: inside your own system, where inputs are not chosen by an attacker.
- Old systems: when a published checksum is only given in MD5, checking it is better than not checking at all.
For anything an attacker could influence, use SHA-256.
Why never use them for passwords?
SHA-256 is designed to be fast, and a graphics card can test billions of guesses per second. Passwords need a deliberately slow, salted function such as Argon2id, bcrypt or scrypt, which most frameworks provide out of the box. A plain SHA-256 of a password is only slightly better than storing it in clear text.
Compute a hash now
Paste text into the hash generator to get SHA-1, SHA-256, SHA-384 and SHA-512 at once, in hex or Base64, or one hash per line. It uses your browser’s built-in Web Crypto, so the text is not sent anywhere. MD5 is left out on purpose, since browsers do not offer it.
FAQ
Is SHA-256 better than MD5?
Yes for security. MD5 collisions can be produced on purpose; no practical attack on SHA-256 is known.
Can a SHA-256 hash be reversed?
No. A hash cannot be decoded. Short or common inputs can be guessed by trying candidates, which is why passwords need a slow, salted hash.
Why is my SHA-256 different from someone else’s for the same text?
Usually an invisible difference: a trailing newline, a space, or a different text encoding. Hash the exact same bytes and the result is the same.
Is SHA-1 still safe for Git?
Git detects the known collision attack and offers SHA-256 repositories. For new security-sensitive uses, choose SHA-256.
Last updated: November 2026. Facts about third-party tools come from their public repositories and documentation. Check licenses before commercial use.