Guide ยท 7 min read

How to Verify File Integrity with Checksums

What a checksum actually proves, how hashing works, and practical guidance on MD5 vs SHA-1 vs SHA-256 vs SHA-512 for verifying downloads.

What a Checksum Actually Verifies

A checksum (or hash) is a fixed-length string generated from a file's contents using a hashing algorithm. Its job is narrow but useful: confirm that a file hasn't been corrupted or altered since the hash was generated. If even a single bit of the file changes, the resulting hash changes completely and unpredictably โ€” this is known as the avalanche effect.

What a checksum does not do on its own is prove who created the file or that it's safe to run โ€” it only proves the file matches the exact bytes the hash was generated from.

How Hashing Works, at a High Level

A cryptographic hash function takes an input of any size and produces a fixed-length output โ€” for example, SHA-256 always produces a 256-bit (64 hex character) output, whether you hash one byte or ten gigabytes. Three properties matter for integrity checking:

  • Deterministic โ€” the same input always produces exactly the same output.
  • One-way โ€” you cannot feasibly reconstruct the original input from the hash alone.
  • Collision-resistant (for strong algorithms) โ€” it should be computationally infeasible to find two different inputs that produce the same hash.

MD5 vs SHA-1 vs SHA-256 vs SHA-512: Practical Guidance

MD5 and SHA-1 are both considered cryptographically broken โ€” practical collision attacks exist for both, meaning a motivated attacker can craft two different files that produce the same hash. They're still commonly seen for basic accidental-corruption checks (confirming a download wasn't truncated or damaged in transit) but should not be trusted for anything where an adversary might deliberately try to fake a match.

SHA-256 is the current practical standard for security-sensitive verification โ€” software downloads, checksums published alongside releases, and most modern security tooling. No practical collision attack is known against it.

SHA-512 offers a larger output and a similar security margin to SHA-256, with a small performance difference depending on the platform (SHA-512 can actually be faster on 64-bit hardware despite the longer output).

Generate any of these instantly with the Hash and Checksum Generator, from text or from a file directly in your browser.

Worked Example: Verifying a Downloaded File

Say a vendor publishes a software download alongside this line:

SHA256 (installer.exe) = 3a7bd3e2360a3d29eea436fcfb7e44c735d117c42d1c1835420b6b9942dd4f1

After downloading the file, generate its SHA-256 hash yourself and compare it character-by-character against the published value. An exact match confirms the file downloaded completely and wasn't corrupted or altered in transit. Any difference โ€” even a single character โ€” means something changed, and the file should not be trusted or run until re-downloaded from a verified source.

When Checksums Aren't Enough

A checksum only proves the file matches the bytes the hash was generated from โ€” it says nothing about whether the source publishing that hash is trustworthy in the first place. If an attacker compromises the download page itself, they can publish a malicious file alongside a matching malicious hash, and the checksum will "verify" perfectly.

For genuine authenticity โ€” proving a file actually came from who it claims to be from, not just that it matches a given hash โ€” you need code signing (a cryptographic signature tied to a verified publisher identity) or PGP/GPG signing, which checksums alone don't provide.

Tools For This Guide

Frequently Asked Questions

Is MD5 safe to use for checksums?
MD5 is fine for detecting accidental corruption (a truncated or damaged download) but should not be relied on where someone might deliberately try to fake a match โ€” practical collision attacks against MD5 are well established. Use SHA-256 for anything security-sensitive.
What does it mean if a downloaded file's hash doesn't match the published one?
It means the file you have does not exactly match the file the hash was generated from โ€” it may have been corrupted during download, or in a worse case, tampered with. Don't run or trust the file; re-download it from a verified source and check again.
Does a matching checksum prove a file is safe?
No โ€” it only proves the file matches the specific bytes that hash was generated from. If the source of both the file and the published hash is compromised, a malicious file and a matching malicious hash can both be published together. Genuine authenticity requires code signing or PGP/GPG signatures, not a checksum alone.
Should I use SHA-256 or SHA-512?
Both offer a strong, currently-unbroken security margin. SHA-256 is more commonly published by vendors and tooling, so it's the more practical default for compatibility. SHA-512 has a larger output and can be faster on 64-bit hardware, but the practical difference for most verification tasks is minimal.

Generate or Verify a Checksum Now

Generate SHA-1, SHA-256, SHA-384 and SHA-512 hashes from text or files, entirely in your browser.