Short answer: choose SHA-256 for a new file checksum, content digest, or general collision-resistant integrity task unless a specification requires another current algorithm. Use MD5 only to interoperate with a legacy field or checksum and never for signatures, certificates, secure software publication, or passwords. Neither bare hash authenticates a publisher, encrypts data, or safely stores a password.

SHA-256 and MD5 at a glance

PropertySHA-256MD5
Digest size256 bits, 32 bytes, 64 hex characters128 bits, 16 bytes, 32 hex characters
Algorithm familySHA-2MD family
Collision resistanceNo practical break publicly known for full SHA-256Broken; practical collision techniques exist
New general checksumsWidely supported defaultDo not choose for adversarial integrity
Legacy compatibilityMay not fit old 32-character fieldsStill present in old protocols and data stores
Password storageToo fast as a bare hashToo fast and additionally obsolete
Authenticity by itselfNoNo

Digest length is the easiest visible difference, but not the complete reason to choose. SHA-256 is standardized in NIST FIPS 180-4 as part of SHA-2. MD5's updated security considerations are summarized in RFC 6151, which says MD5 is no longer acceptable where collision resistance is required.

What SHA-256 and MD5 have in common

Both functions accept an arbitrary sequence of bytes and deterministically emit a fixed-size digest. Hashing the same bytes with the same algorithm produces the same result on any correct implementation. Changing one byte normally changes many output bits. Hexadecimal and Base64 are merely encodings of the digest bytes; selecting a different display format does not calculate a different algorithm.

Neither function stores a filename, media type, encoding label, timestamp, publisher, signature, or key. When text is the source, an application must first decide which bytes represent the text. UTF-8 with LF line endings and UTF-8 with CRLF line endings create different inputs. An archive and its extracted directory are also different input objects even when the visible files seem equivalent.

Both are fast general-purpose hashes. Speed is useful for file verification and content indexing, but it is a liability for password verification because an attacker can test guesses rapidly. A different digest length does not turn a fast primitive into a password KDF.

Why MD5 collision resistance is broken

A collision is a pair of distinct messages with the same hash. An ideal 128-bit digest would offer about 64 bits of generic birthday-bound collision security, but MD5 is much weaker than that ideal because cryptanalytic attacks exploit its internal structure. Researchers have demonstrated practical collisions and chosen-prefix collision techniques, where attackers can influence different prefixes and construct suffixes that make the complete MD5 values agree.

This matters whenever a system approves or signs a digest instead of reading every byte. Two colliding documents can carry different visible meaning while presenting the same MD5 value to the approval step. Changing MD5 output to uppercase, Base64, or a longer field cannot restore lost collision resistance. Hashing the MD5 result again also does not provide a sound migration from a broken acceptance rule.

MD5 preimage attacks, collisions, and password guessing are different questions. The lack of a generic decryption operation does not rescue collision-sensitive use. Likewise, an input may be easy to guess even when no one can mathematically invert an arbitrary digest. Choose controls for the actual property required.

What SHA-256 security does and does not provide

For current ordinary use, full SHA-256 is treated as collision-resistant, preimage-resistant, and second-preimage-resistant when correctly implemented. Its 256-bit digest gives a generic collision bound around 2128 operations and a generic preimage bound around 2256, although those are idealized work factors rather than performance promises.

A modern primitive can still be used in an insecure protocol. A bare SHA-256 checksum has no secret, so anyone who changes a file can calculate the new checksum. If a download server is compromised and hosts both artifacts and checksums, matching SHA-256 values do not independently authenticate the publisher. Signed release metadata, a verified digital signature, or a separately trusted expected digest supplies the missing trust relationship.

Do not invent a MAC by placing a secret before or after a message and hashing the concatenation. Use HMAC-SHA-256 through a reviewed library when a shared-secret message authentication code is the specified construction. Use authenticated encryption when confidentiality is also required.

Choosing a file checksum

When a publisher supplies one expected value, use the named algorithm exactly. A 32-character MD5 value cannot be compared with a 64-character SHA-256 result. For a new checksum list, SHA-256 balances modern security, widespread command-line support, package-manager compatibility, and manageable output size.

  1. Identify the exact artifact. Architecture, compression format, build flavor, and version all matter.
  2. Obtain the expected digest through a trusted path. Prefer signed metadata when malicious replacement is in scope.
  3. Hash the original bytes. Do not extract or resave a file before verifying the checksum published for the archive.
  4. Compare the complete value. Hex letter case can differ, but every digit must represent the same bytes.
  5. Stop on mismatch. Redownload and investigate rather than assuming the difference is harmless.

The LiveParse File Checksum Calculator reads a selected file locally and can compare an expected value. For a command-line or signature-centered workflow, follow the file checksum verification guide.

Neither algorithm is a password storage scheme

One SHA-256 or MD5 calculation is cheap by design. After stealing a verifier database, an attacker can hash candidate passwords offline without the server's rate limit. MD5 is especially fast and obsolete, but swapping the function name to SHA-256 still leaves the basic password-guessing problem.

Use a dedicated password-hashing library built around Argon2id, scrypt, bcrypt, or PBKDF2. Each record needs a unique random salt, algorithm and parameter metadata, a calibrated work factor, and a rehash strategy. Argon2id and scrypt can impose memory cost in addition to computation. PBKDF2 and bcrypt remain necessary in some compatibility and compliance environments but require informed parameter choices.

Do not use this site's generators to process real user passwords for storage. The tools intentionally calculate fast, unsalted digests and have no account-level parameter, migration, rate-limit, or secret-management policy.

How to migrate an MD5 checksum field

Begin by inventorying every producer, consumer, database column, API contract, cache, fixture, and external partner that assumes a 32-character digest. Add an explicit algorithm identifier rather than guessing from length forever. New records can receive SHA-256 immediately once every reader understands the field.

Backfill only from trusted original bytes. Hashing the old MD5 text with SHA-256 creates a digest of the legacy checksum, not a SHA-256 digest of the original content. If the content is gone, preserve the MD5 record as historical metadata until it can expire; do not relabel it.

During a bounded dual-read period, compare according to the stored algorithm and write only the new format. Instrument the remaining MD5 reads so owners can eliminate them. Security-sensitive acceptance paths should move first and should not silently fall back to MD5 after SHA-256 fails.

Need to compare real outputs? Generate both digests from the same UTF-8 bytes, then use SHA-256 for the new contract and retain MD5 only where a legacy consumer still requires it.

Open the Hash Generator

Frequently asked questions

Is SHA-256 better than MD5?

Yes for new security-sensitive integrity work. SHA-256 provides a 256-bit digest and has no practical collision attack comparable to MD5, while MD5 collision resistance is broken. The complete protocol and trust source still determine actual security.

Why do websites still publish MD5 checksums?

Legacy tooling, old APIs, historical databases, and non-adversarial corruption checks keep MD5 in use. Compatibility explains its presence but does not make it suitable for signatures, secure release verification, or new designs.

Can MD5 still detect an accidental download error?

It can often detect random corruption when no attacker is choosing the bytes, but SHA-256 is a better default for a new checksum. If the publisher supplies only MD5, a match is a limited compatibility check rather than collision-resistant security evidence.

Can SHA-256 or MD5 encrypt data?

No. Both are one-way hash functions, not encryption algorithms. They do not use a decryption key or provide confidentiality. Use authenticated encryption when data must remain secret and resist modification.

Is SHA-256 suitable for password storage?

Not as one fast hash pass. Password storage needs a dedicated KDF such as Argon2id, scrypt, bcrypt, or PBKDF2 with a unique salt and tuned cost. SHA-256 may appear inside a reviewed construction, but a bare digest is inadequate.

How should a system migrate from MD5 to SHA-256?

Add an algorithm identifier, generate SHA-256 for new data, backfill or recalculate where trusted original bytes exist, support both formats only during a bounded transition, and remove MD5 from every security acceptance path.