Which hash should I use?
A hash turns any amount of data into a short fixed-size fingerprint. The same input always gives the same fingerprint, and a one-bit change gives a completely different one. The five algorithms here differ in length and in how much you can trust them:
- MD5: 128 bits, 32 hex characters. Broken for security, because different inputs with the same hash can be made on purpose. Still fine for catching accidental damage.
- SHA-1: 160 bits, 40 hex characters. Also broken for collisions: a practical collision was published in 2017. Avoid it for anything new.
- SHA-256: 256 bits, 64 hex characters. The sensible default for checksums, fingerprints and cache keys.
- SHA-384: 384 bits, 96 hex characters. A shortened SHA-512, common in some signing and TLS settings.
- SHA-512: 512 bits, 128 hex characters. On 64-bit processors it can be faster than SHA-256 for large data.
Hashes are not password storage
A hash is not encryption. You cannot turn it back into the original, but you can guess: an attacker hashes millions of likely inputs and looks for a match. All five algorithms here are designed to be fast, so a modern graphics card can try billions of guesses a second against a leaked list of fast hashes.
Passwords need a function that is slow on purpose and adds a unique random salt per user: Argon2, scrypt or bcrypt. If you only need to fingerprint a file or detect changes, a fast hash like SHA-256 is the right tool. Making a strong password in the first place is a job for the password generator.
Verifying a download
Software sites often publish a checksum next to the download. To check it, hash the file here and paste the published value into Compare with a hash. A match means your copy is bit for bit the same as the file the checksum was made from, so the download was not cut short or damaged.
A checksum from the same page as the download does not prove the file is safe: someone who can replace the file can replace the checksum. It is strongest when the checksum comes from a different, trusted place, or when it is signed. To cross-check on your own machine: sha256sum file on Linux, shasum -a 256 file on macOS, and Get-FileHash file -Algorithm SHA256 in Windows PowerShell.
Why your hash differs from another tool
When two tools disagree about the same text, the input is almost never the same. The usual causes:
- A trailing newline. In a terminal,
echo helloadds a line break andprintf hellodoes not. The hashes ofhelloandhelloplus a newline are completely different. This page adds nothing to what you type. - Line endings. Windows uses two characters (CRLF) and Linux and macOS use one (LF). A file saved on one and hashed on another can differ.
- Text encoding. This page hashes text as UTF-8. Some tools hash UTF-16, which gives a different result for the same words.
- Invisible characters. A byte order mark, a non-breaking space or a trailing space changes the hash. The byte count shown under the text box helps spot them.
Upper or lower case in the hash itself never matters: ABCD and abcd are the same value written two ways.