How to Verify a File's Checksum (Windows, Mac & Linux)

Compute the file's SHA-256 hash with your system's built-in command and compare it with the value the publisher posted: if every character matches, your copy is byte-for-byte the file they published. On Windows run Get-FileHash file.iso in PowerShell, on macOS shasum -a 256 file.iso, and on Linux sha256sum file.iso.

How to verify the checksum of a downloaded file

The steps are the same on every system. Only the command in step 3 changes.

  1. Find the published checksum and its algorithm. It is on the download page or in a small file such as SHA256SUMS, sha256sum.txt or file.iso.sha256. If the value has no label, its length tells you the algorithm (see the length table below).
  2. Let the download finish, then open a terminal in the folder that holds the file, usually Downloads.
  3. Compute the hash with the command for your system, using the same algorithm as the published value.
  4. Compare the whole string, and let the computer do the comparison where you can. Letter case does not matter: BA78 and ba78 are the same hex value.
  5. If the values match, the file is intact. If they don't, work through SHA-256 checksum does not match.

All example output on this page comes from hashing a file named abc.txt that contains exactly the three bytes abc. NIST FIPS 180-4 publishes the SHA-256 of that input, so you can recreate the file and check that you get the same result (instructions in Check that your tool is honest first). The Windows and Git Bash outputs were captured on Windows 11 on 2026-10-26.

How to verify a checksum in Windows PowerShell

Get-FileHash is built into PowerShell and uses SHA-256 unless you pass -Algorithm:

Get-FileHash .\abc.txt

Example output (Windows PowerShell 5.1, path shortened):

Algorithm       Hash                                                                   Path
---------       ----                                                                   ----
SHA256          BA7816BF8F01CFEA414140DE5DAE2223B00361A396177A9CB410FF61F20015AD       C:\Users\...\abc.txt

A long path pushes the hash off the right edge of narrow windows. Add | Format-List to put each field on its own line.

To compare without reading 64 characters, paste the published value into this line:

(Get-FileHash .\abc.txt).Hash -eq "ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad"

It prints True or False. PowerShell's -eq ignores case for strings, so the uppercase output and a lowercase published value compare correctly. A space copied along with the hash makes the result False; if you suspect one, add .Trim() after the closing quote.

For other algorithms, pass -Algorithm SHA1, SHA384, SHA512 or MD5. Get-FileHash .\abc.txt -Algorithm MD5 returns 900150983CD24FB0D6963F7D28E17F72.

How to verify a checksum in Windows CMD (certutil)

In Command Prompt, use certutil, which ships with Windows:

certutil -hashfile abc.txt SHA256

Example output:

SHA256 hash of abc.txt:
ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad
CertUtil: -hashfile command completed successfully.

Always name the algorithm. Without it, certutil computes SHA-1, which never matches a published SHA-256:

certutil -hashfile abc.txt
SHA1 hash of abc.txt:
a9993e364706816aba3e25717850c26c9cd0d89d
CertUtil: -hashfile command completed successfully.

The algorithm name is not case-sensitive (sha256 works too), and MD5, SHA1, SHA384 and SHA512 are accepted. To have CMD do the comparison, pipe the output through find:

certutil -hashfile abc.txt SHA256 | find /i "ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad"

If the hash matches, the matching line is printed (exit code 0). If not, nothing is printed (exit code 1). The /i makes the search ignore case.

One quirk: on the Windows 11 build we tested, certutil refuses a zero-byte file with CertUtil: -hashfile command FAILED: 0x800703ee (WIN32: 1006 ERROR_FILE_INVALID) instead of printing a hash. If you see that on a download, the file is empty and the download failed.

How to verify a checksum on macOS

Open Terminal and use shasum, which macOS includes:

shasum -a 256 abc.txt

Expected output, hash first, then two spaces and the file name:

ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad  abc.txt

Don't leave out -a 256. Without it shasum computes SHA-1, a 40-character value. To check against a downloaded SHA256SUMS file, or against a single pasted value, use -c; both print abc.txt: OK on a match:

shasum -a 256 -c SHA256SUMS
echo "ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad  abc.txt" | shasum -a 256 -c

For a published MD5, macOS has md5, which prints in a different layout: MD5 (abc.txt) = 900150983cd24fb0d6963f7d28e17f72. Add -q to print only the hash.

How these were checked: we have no Mac to run them on. shasum is a Perl script from the Digest::SHA module, and we ran the same script (version 6.04, bundled with Git for Windows) with the commands above; the output layout follows its manual. The md5 layout is from the BSD md5(1) manual, not from a Mac.

How to verify a SHA-256 checksum in Linux

Linux distributions include sha256sum from GNU coreutils:

sha256sum abc.txt

Expected output on Linux:

ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad  abc.txt

In Git Bash on Windows (coreutils 8.32), the same command prints ba7816bf…20015ad *abc.txt. The * marks binary read mode and does not change the hash; GNU's documentation notes there is no difference between the modes on GNU systems.

Publishers such as Linux distributions post one SHA256SUMS file that lists every image they release. Put it in the same folder as your download and run:

sha256sum -c --ignore-missing SHA256SUMS

That prints abc.txt: OK for each listed file you have; --ignore-missing skips the files you didn't download. To check against one pasted value instead, the line must be the hash, two spaces, then the file name:

echo "ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad  abc.txt" | sha256sum -c

On a mismatch you get this, and the exit status is 1, so it also works in scripts:

abc.txt: FAILED
sha256sum: WARNING: 1 computed checksum did NOT match

For a published MD5, md5sum abc.txt works the same way.

SHA-256 checksum does not match: what to check

A mismatch means the bytes you hashed are not the bytes the publisher hashed. That is usually a problem on your side rather than tampering. Check these in order; the early ones take seconds.

The download is incomplete

Compare the file size with the size on the download page. While a download is running, or after it stops partway, Chrome and Edge keep the partial file with a .crdownload extension and Firefox with .part. Hashing that file, or a full-looking file from an interrupted transfer, gives a different hash. Delete it and download again.

You hashed a different file

Browsers rename repeat downloads to file (1).iso, so the file you hashed may be an older copy. Type the first letters of the name and press Tab to complete it rather than retyping. If the result is e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855, the tool read zero bytes: that is the SHA-256 of an empty file.

The checksum is for a different version or architecture

A SHA256SUMS file has one line per file, and the names differ by a version number or by amd64/arm64. Compare against the line whose file name matches yours exactly.

You compared different algorithms

Count the characters in both values. If the lengths differ, the algorithms differ:

Hex charactersAlgorithm
32MD5
40SHA-1
64SHA-256
128SHA-512

A 40-character result usually means you ran certutil -hashfile or shasum without naming SHA-256, since both default to SHA-1.

The expected hash has a stray space or a Windows line ending

A checksum file saved or edited on Windows can end each line with a carriage return. GNU sha256sum -c then treats the return as part of the file name and reports:

sha256sum: 'abc.txt'$'\r': No such file or directory
abc.txt: FAILED open or read

Strip the carriage returns with sed -i 's/\r$//' SHA256SUMS and run the check again. In PowerShell, a leading or trailing space in the pasted value turns -eq into False; .Trim() removes it.

The browser unpacked a .gz file

With some server configurations a browser decompresses a .tar.gz or .gz download as it arrives but keeps the .gz name. The published checksum is for the compressed bytes, so it can't match. Check whether the file is really gzip. On Linux, macOS or Git Bash:

file download.tar.gz
download.tar.gz: gzip compressed data, ...

In Windows PowerShell 5.1, read the first two bytes; a gzip file starts with 1F 8B:

Get-Content .\download.tar.gz -Encoding Byte -TotalCount 2 | ForEach-Object { '{0:X2}' -f $_ }
1F
8B

(In PowerShell 7, use -AsByteStream in place of -Encoding Byte.) If the file is not gzip, download it with curl -LO followed by the URL. curl saves the bytes as sent unless you ask it to decompress.

If it still does not match

After a clean download from the publisher's own site, with the right file, algorithm and line, a mismatch is a real warning. The mirror may be bad or the file may have been replaced. Don't open or install it, and tell the publisher.

Does a matching checksum mean the file is safe?

It proves integrity: your copy is identical to the file whose hash was published. It does not prove authenticity on its own. An attacker who can replace a download on a server can often replace the checksum on the same page, and then both agree. Publishers who guard against this sign their checksum file with GPG (for example SHA256SUMS.gpg next to SHA256SUMS); verifying that signature against the publisher's known public key shows who produced the list. Prefer SHA-256 over MD5 or SHA-1 for the same reason: deliberate collisions are practical for those two (see MD5 vs SHA-256).

Verify a checksum without the terminal

Our checksum tool hashes a file in your browser: drop the file in and it computes SHA-256, SHA-512, SHA-1, MD5 and CRC32 locally. Paste the published value and it reports match or no match; it ignores case and whitespace and picks the algorithm from the value's length. The file is not uploaded. For hashing a short piece of text with SHA-256 or SHA-512, use the hash generator.

Frequently asked questions

Is a checksum the same as a hash?
In this context, yes. A file checksum is the output of a hash function such as SHA-256 or MD5 run over the file's bytes. "Checksum" also covers simpler error-detecting codes such as CRC32, which catch accidental damage but offer no protection against deliberate changes, so prefer a published SHA-256 when one is available.
What is a SHA256SUMS file?
It is a plain text file that lists the SHA-256 hash of each file a publisher releases, one per line, as the hash followed by two spaces and the file name. You can check a download against it with sha256sum -c --ignore-missing SHA256SUMS on Linux or shasum -a 256 -c SHA256SUMS on macOS. Many publishers also sign it, for example as SHA256SUMS.gpg.
Is MD5 good enough for verifying a download?
MD5 still detects accidental corruption such as a truncated or damaged download. It does not protect against deliberate tampering, because practical MD5 collision attacks have existed since 2004. If the publisher offers SHA-256, use that; if only MD5 is offered, treat a match as proof the transfer worked, not as proof the file is genuine.
Does verifying a checksum check the file for viruses?
No. A matching checksum only shows that your copy is identical to the file the publisher hashed. If the publisher's own file contained malware, the checksum would still match. Checksums protect the path between the publisher and you; scanning and trusting the publisher are separate questions.

Check that your tool is honest first

Before trusting any checksum tool, ours included, give it an input with a known answer. FIPS 180-4 publishes the SHA-256 digest of short fixed inputs, so a correct implementation has no room to disagree:

InputSHA-256
abcba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad
(empty)e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855

To create the abc.txt used throughout this page with no trailing newline, run printf 'abc' > abc.txt in a Unix shell, or in PowerShell:

[IO.File]::WriteAllText("$PWD\abc.txt", "abc")

Avoid echo abc > abc.txt: it adds a newline, and the file then hashes to edeaaff3f1774ad2888673770c6d64097e391bc362d7d6fb34982ddf0efd18cb. Run the file through your system's command and the same text through our hash generator. If they agree with the table, any mismatch you later see on a real download is the file's problem, not the tool's.

Sources

Commands and output formats are checked against each tool's own documentation and, where noted above, by running them. Test values come from the standards that define them:

This guide is general technical information. Always obtain checksums and downloads from the publisher's official source.