MD5 vs SHA-256: which checksum to use
A download page lists a long string of letters and numbers next to the file. That is a checksum, and comparing it with your copy tells you whether the file arrived intact. This guide explains MD5 and SHA-256 and when each is appropriate.
Free tools for this
- MD5 Hash GeneratorCreate the MD5 checksum of any text (UTF-8), line by line or as a whole. MD5 is for checksums, not for passwords.
- File Checksum (SHA-256 / SHA-1 / SHA-512)Verify a download or compare two files. The file is read on your device only.
- Hash Generator (SHA)Create SHA-1, SHA-256, SHA-384 and SHA-512 hashes of any text.
1. What a hash is
A hash function turns any input into a fixed-length fingerprint. The same input always gives the same fingerprint, and a tiny change gives a completely different one. For the text abc:
| Algorithm | Length | Hash of โabcโ |
|---|---|---|
| MD5 | 128 bits (32 hex characters) | 900150983cd24fb0d6963f7d28e17f72 |
| SHA-256 | 256 bits (64 hex characters) | ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad |
Both values were produced by the Kitwise tools and match the published test values for these algorithms.
2. Why MD5 is not safe for security
Researchers can create two different files with the same MD5 hash. That means an MD5 checksum cannot prove a file was not swapped by an attacker, and MD5 must never be used to store passwords. SHA-1 has the same problem. SHA-256 has no known practical collisions.
3. When MD5 is still fine
- Spotting accidental damage, such as a broken download or a bad copy, when the publisher only gives MD5.
- Cache keys and duplicate detection inside your own systems.
- Old systems and APIs that require it.
4. Verify a download
- Find the checksum on the official download page and note the algorithm (usually SHA-256).
- Open the File Checksum tool and choose the downloaded file; it is read in your browser, not uploaded.
- Compare the two values. They must match exactly; if not, download again from the official site.
Tip: A matching checksum proves the file is the one listed on that page, not that the page itself is trustworthy. Download from the official site.
Questions
Can an MD5 hash be reversed?
Not directly, but short or common inputs can be found in lookup lists, which is another reason not to use MD5 for passwords.
Which hash should I use for passwords?
None of these on their own. Use a password hashing method such as bcrypt, scrypt or Argon2.
Is SHA-256 the same as SHA-2?
SHA-256 is one member of the SHA-2 family, which also includes SHA-384 and SHA-512.