Verify SHA-256 checksums on Windows, macOS and Linux
Calculate a file’s SHA-256 locally, compare the complete publisher checksum and understand what a matching result can prove.
In this guide
A checksum describes file contents. A matching result establishes agreement with that checksum, not that the program is safe. If an attacker replaces both the file and the published value, this comparison cannot detect it.
Find the correct reference value
Use the publisher’s official instructions for the exact version, operating system and architecture. A ZIP archive and the EXE extracted from it have different bytes. SHA-256 and SHA-512 are different algorithms; hexadecimal SHA-256 has 64 characters. Letter case does not change their value. Verify a publisher’s digital signature too when available.
PowerShell: calculate and compare
In the folder containing the download, replace the filename and reference placeholder:
Get-FileHash -LiteralPath '.\installer.exe' -Algorithm SHA256
$expected = 'PASTE_THE_PUBLISHERS_64_HEX_CHARACTERS'
$actual = (Get-FileHash -LiteralPath '.\installer.exe' -Algorithm SHA256).Hash
($expected -match '^[0-9a-fA-F]{64}$') -and ($actual -ieq $expected)
The final expression returns True only for a valid reference of that length matching the whole hash. These commands read the file; they do not execute it. Keep paths containing spaces quoted.
Command Prompt: certutil
Run this in CMD and compare its full hash line with the publisher’s value:
certutil -hashfile ".\installer.exe" SHA256
The success message means calculation succeeded, not that the reference matches. sha256sum is not a standard CMD command; it requires an additional environment such as WSL or suitable installed tools.
Browser option and mismatches
The checksum tool accepts files up to 20 MiB and reads the whole file into browser memory. Choose the same algorithm and paste the full expected checksum. Use a system tool for larger files.
For a mismatch, do not run the file. Check version, architecture, algorithm and download completeness, then download again from the official source. Contact the publisher if it persists. Never search for an arbitrary matching checksum to justify the file.
A small SHA-256 example you can reproduce
The three bytes 61 62 63 are the text abc in UTF-8 with no byte order mark and no line ending. Their SHA-256 is:
ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015adThis is one 64-character value. To test PowerShell without creating or overwriting a file, hash an in-memory stream:
$demoBytes = [byte[]](0x61, 0x62, 0x63)
$demoStream = [System.IO.MemoryStream]::new($demoBytes)
try {
(Get-FileHash -InputStream $demoStream -Algorithm SHA256).Hash
} finally {
$demoStream.Dispose()
}Why a file containing “abc” might give another result
A text editor may add a newline or a byte order mark. Those are additional bytes, so the file is different. Compare the original downloaded file directly; opening and saving it can change what you are checking.
Does changing the filename change SHA-256?
Renaming a file without changing its contents leaves its checksum unchanged. An archive and the extracted file have different contents, so compare the checksum published for that exact object.
Microsoft reference: Get-FileHash, including InputStream
Command and reference check: . PowerShell and certutil were checked with the downloadable sample files. A matching checksum alone does not confirm that a file is safe.