Security

MD5 vs SHA-256: A Plain-English Guide to Hashing

Published October 2026 · 5 min read

You have probably seen a long string of random-looking letters and numbers next to a file download, labelled something like "MD5" or "SHA-256." That string is a hash, and it is one of the most useful ideas in computing. This guide explains what a hash actually is, why the old favourite MD5 should no longer be trusted, and when SHA-256 is the right tool for the job.

What a hash actually is

A hash function takes any input — a word, a password, a 4 GB video file — and turns it into a fixed-length string called a "digest" or "fingerprint." No matter how big the input is, the output is always the same size.

Two properties make hashes special:

Crucially, a hash is a one-way trip. You cannot take a digest and work backwards to recover the original input. That is what makes hashing different from encryption, which is designed to be reversed with the right key.

The properties that matter

That last property is exactly where MD5 falls apart.

MD5: fast, familiar, and broken

MD5 produces a 128-bit digest and has been around since the early 1990s. It is fast and still shows up everywhere, which is precisely the problem: it is cryptographically broken. Researchers can now produce collisions — two different inputs with the same MD5 digest — cheaply and on demand.

That means you should never use MD5 for anything security-related: digital signatures, certificates, or verifying that a file has not been tampered with by an attacker. A motivated adversary can craft a malicious file that matches the "expected" MD5 of a legitimate one.

MD5 only survives in non-security contexts — for example, a quick checksum to catch accidental corruption during a download or a disk copy. Even there, SHA-256 is the better default, so there is rarely a good reason to reach for MD5 in new code.

SHA-256: the modern default

SHA-256 is part of the SHA-2 family and produces a 256-bit digest. It is currently considered secure, with no practical collision or preimage attacks known. That is why it underpins so much of the modern internet: TLS certificates, blockchain networks, software signing, and file-integrity checks all rely on it.

Side by side

AlgorithmOutput sizeStatusSafe for security?
MD5128-bitBroken (practical collisions)No
SHA-256256-bitConsidered secureYes

One important warning about passwords

Here is a mistake even experienced developers make: hashing a password with plain MD5 or plain SHA-256 is not enough. These are fast, general-purpose hashes — and "fast" is exactly what you do not want for passwords, because it lets attackers test billions of guesses per second.

For storing passwords, use a deliberately slow password-hashing function such as bcrypt, scrypt, or Argon2, each combined with a unique salt. Reserve fast hashes like SHA-256 for integrity checks, not for password storage.

When to reach for a hash

Generate an MD5 or SHA-256 hashPaste any text and get its digest instantly — the hashing happens right in your browser.
Open Base64 & Hash Tool →

The takeaway

A hash turns any input into a fixed-length fingerprint you can trust to be consistent — but only if the algorithm behind it still holds up. MD5 no longer does, so treat it as a relic for accidental-corruption checks at most. For anything that matters, reach for SHA-256 — and remember that passwords need a slow, salted hash of their own.