How to verify a download with a SHA-256 checksum on Linux, macOS, Windows and CI

Step-by-step instructions and scripts for verifying file integrity with SHA-256 hashes across GNU/Linux, macOS, Windows PowerShell, Python, Node.js, and Web Crypto API.

1. Why byte count alone does not prove file integrity

Checking that a downloaded 10 KB PDF file is 10,240 bytes catches gross truncation (such as a connection dropping halfway through a transfer), but it cannot detect bit rot, middlebox modification, or an encoding bug that replaced 0x0D 0x0A with two spaces of the same byte length. A cryptographic hash function like SHA-256 (standardized by NIST in FIPS 180-4) processes the entire byte sequence in 512-bit blocks and emits a fixed 256-bit (64-character hexadecimal) digest. Due to the avalanche effect, changing even a single bit in a 1 GB file changes roughly half of the bits in the resulting SHA-256 output.

2. Command-line verification on Linux, macOS and Windows PowerShell

Every operating system ships with a built-in SHA-256 utility—you never need to install third-party shareware to verify a checksum:

# 1. Linux (GNU coreutils sha256sum)
sha256sum sample-pdf-10kb.pdf
# Expected output:
# 55e329b46c35eb939ef575591e6bafe9f1e97d5f7fcb1fca8bfba23cd76d0fb8  sample-pdf-10kb.pdf

# One-line batch check against SampleTestFiles' master checksums.txt:
sha256sum -c --ignore-missing checksums.txt

# 2. macOS (shasum or openssl)
shasum -a 256 sample-pdf-10kb.pdf
openssl dgst -sha256 sample-pdf-10kb.pdf

# 3. Windows PowerShell (Get-FileHash or certutil)
Get-FileHash .\sample-pdf-10kb.pdf -Algorithm SHA256
certutil -hashfile .\sample-pdf-10kb.pdf SHA256

3. Verifying SHA-256 in Python, Node.js and Browser Web Crypto

When writing automated download tests or custom ingestion pipelines, compute the SHA-256 digest in streaming chunks so large files never exhaust process memory:

# Python 3.11+ streaming file digest (reads in 64 KB chunks automatically)
import hashlib

with open("sample-parquet-sales-100.parquet", "rb") as f:
    digest = hashlib.file_digest(f, "sha256").hexdigest()
print("SHA-256:", digest)
// Browser Web Crypto API (used by SampleTestFiles' /inspector/ and generator)
async function sha256Blob(blob) {{
  const buffer = await blob.arrayBuffer();
  const hashBuffer = await crypto.subtle.digest('SHA-256', buffer);
  return Array.from(new Uint8Array(hashBuffer))
    .map(b => b.toString(16).padStart(2, '0'))
    .join('');
}}

Looking for the published hash of any file on this site? Browse the complete table on /checksums/, download /checksums.txt, or drop your file into the in-browser File Inspector.

Related guides and test tools

Frequently asked questions

What is the SHA-256 hash of a 0-byte empty file?
The SHA-256 digest of zero bytes (such as empty-file.txt or zero-byte-empty.bin) is always e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855.
Why might a text file's SHA-256 hash change after committing it to Git on Windows?
If Git's core.autocrlf setting is enabled, Git converts LF (0x0A) line endings to CRLF (0x0D 0x0A) on checkout, which changes the byte count and the SHA-256 hash. Add `*.csv -text` or `* binary` to `.gitattributes` for test fixtures.

Operational transparency, verification and developer reference

For technical questions or feedback regarding SampleTestFiles, contact contact@sjwebtechwork.com. Every sample file, dataset, and diagnostic utility on this site follows strict reproducibility and privacy rules: