🔐 encrypt.tools
HASHING · HOW-TO

How to Verify a SHA-256 Checksum on Windows, macOS and Linux

Step-by-step commands to check a file's SHA-256 hash on Windows (PowerShell, certutil), macOS and Linux — plus how to verify the checksum file itself with GPG, and what a mismatch means.

By ··5 min read

Key takeaways

  • Windows: Get-FileHash .\file.iso in PowerShell (SHA-256 by default), or certutil -hashfile file.iso SHA256 in Command Prompt.
  • macOS: shasum -a 256 file.iso (recent versions also have sha256sum).
  • Linux: sha256sum file.iso, or sha256sum -c SHA256SUMS to check against the publisher's list automatically.
  • No terminal? Drop the file into a browser-based file checksum tool that hashes locally without uploading it.
  • A matching checksum only proves the file matches the checksum. If both came from the same compromised server, it proves nothing — verify the GPG signature on the checksum file for real assurance.

When you download an operating system image, a crypto wallet, a database dump or a firmware update, the publisher usually lists a long hexadecimal string next to it — the file's SHA-256 checksum. Computing the hash of your copy and comparing it to that string tells you, with overwhelming certainty, whether the bytes you have are the bytes they published. One flipped bit anywhere in a multi-gigabyte file produces a completely different hash.

Checksums catch two kinds of problems:

  • Accidental corruption — truncated downloads, flaky Wi-Fi, a failing USB stick or disk.
  • Tampering — a compromised mirror or a man-in-the-middle serving a modified file. (With an important caveat covered below.)

Windows

PowerShell: Get-FileHash

Open PowerShell (Start menu → type *PowerShell*), go to your Downloads folder and run:

cd $HOME\Downloads
Get-FileHash .\ubuntu-24.04-desktop-amd64.iso

Algorithm   Hash                                                              Path
---------   ----                                                              ----
SHA256      ...64 HEX CHARACTERS...                                           C:\Users\you\Downloads\ubuntu...

SHA-256 is the default; add -Algorithm SHA512 or -Algorithm MD5 for others. Rather than comparing 64 characters by eye, let PowerShell do it — -eq is case-insensitive, so upper- or lowercase hex both work:

(Get-FileHash .\file.iso).Hash -eq "paste-the-published-checksum-here"
# True  → the file matches
# False → it doesn't

Command Prompt: certutil

certutil is built into every Windows version since Windows 7 and works in a plain Command Prompt:

certutil -hashfile ubuntu-24.04-desktop-amd64.iso SHA256

SHA256 hash of ubuntu-24.04-desktop-amd64.iso:
...64 hex characters...
CertUtil: -hashfile command completed successfully.

macOS

Open Terminal (Applications → Utilities) and use shasum, which ships with every Mac:

$ shasum -a 256 ~/Downloads/demo.iso
ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad  /Users/you/Downloads/demo.iso

Don't forget -a 256 — without it, shasum defaults to the obsolete SHA-1. Recent macOS releases also include sha256sum, which behaves like the Linux command below. Tip: type shasum -a 256 and drag the file from Finder into the Terminal window to paste its path.

Linux

Every mainstream distribution includes GNU coreutils' sha256sum:

$ sha256sum demo.iso
ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad  demo.iso

Checking against a SHA256SUMS file

Many projects (Ubuntu, Debian, Arch, most GitHub releases) publish a file listing the checksum of every download. Put it in the same folder as your file and let the tool compare for you — this avoids eyeballing errors entirely:

$ sha256sum -c SHA256SUMS --ignore-missing
demo.iso: OK

# If the file was altered or corrupted:
demo.iso: FAILED
sha256sum: WARNING: 1 computed checksum did NOT match

--ignore-missing skips entries for files you didn't download. On macOS the equivalent is shasum -a 256 -c SHA256SUMS. You can also create such a file yourself with sha256sum *.tar.gz > SHA256SUMS — handy for verifying backups later.

Without a terminal: in your browser

If you'd rather not use the command line, our file checksum verifier computes SHA-256, SHA-512, SHA-1 and MD5 of a file you drop onto the page, and compares the result with a checksum you paste. The file is read and hashed inside your browser with the Web Crypto API — it is never uploaded, so it works for large or confidential files too.

The catch: who do you trust for the checksum?

A checksum proves that your file matches *the checksum*. If an attacker compromises the download server, they can replace the file and the checksum on the same page — and your comparison will happily say "OK". In 2016, attackers breached the Linux Mint website and pointed its download links at a backdoored ISO — precisely the kind of attack where a checksum hosted on the same site offers no protection.

The fix is a digital signature on the checksum file. The project signs SHA256SUMS with a private GPG key that never touches the web server; you verify it with their public key, obtained once from a trusted source (the project's keyserver entry, their documentation over HTTPS, or a distribution keyring):

# 1. Import the project's signing key (once). Check the fingerprint
#    against the one published in their official documentation.
gpg --keyserver hkps://keyserver.ubuntu.com --recv-keys <FINGERPRINT>

# 2. Verify the signature on the checksum list
gpg --verify SHA256SUMS.gpg SHA256SUMS
#   → "Good signature from ..." is what you want

# 3. Only then check the file against the list
sha256sum -c SHA256SUMS --ignore-missing
  1. A good signature proves the checksum list came from the key holder.
  2. A matching checksum proves your file matches that list.
  3. Together, they prove your file is what the project actually released.

Some projects now sign releases with Sigstore / cosign or minisign instead of GPG; the principle is identical. To learn how OpenPGP keys work hands-on, try our PGP key generator and PGP encryption tool.

Which algorithm should you compare?

Checksum algorithms for file verification
AlgorithmHex lengthStill fine for downloads?
SHA-25664Yes — the standard choice
SHA-512128Yes
SHA-3 / BLAKE2 / BLAKE364+Yes, if the publisher provides them
SHA-140Only to detect accidental corruption — collisions are practical
MD532Only to detect accidental corruption — collisions take seconds

Use whatever the publisher provides, preferring SHA-256 or stronger when there's a choice. MD5 and SHA-1 still reliably catch *accidental* damage, but an attacker can craft two different files with the same MD5 or SHA-1 hash. Our article on whether MD5 and SHA-1 are still safe explains exactly when they are and aren't acceptable.

What to do if the checksum doesn't match

  1. Check you're comparing the right thing — the right file version, the right architecture (amd64 vs arm64), and the right algorithm (a 64-character value is SHA-256, 128 is SHA-512).
  2. Re-download the file, ideally from a different mirror. Partial downloads are the most common cause.
  3. If it still fails, don't run or install it. Report it to the project; a persistent mismatch from an official source may mean a compromised mirror.
FREQUENTLY ASKED

Frequently asked questions

How do I check a SHA-256 hash on Windows without installing anything?

+

Open PowerShell and run Get-FileHash followed by the file path; it uses SHA-256 by default. Alternatively, in Command Prompt run certutil -hashfile followed by the file name and SHA256. Both tools are built into Windows.

Is the checksum comparison case-sensitive?

+

No. Hexadecimal digits A–F mean the same in upper or lower case. Windows shows uppercase and Linux lowercase, but they represent identical values.

Does a matching checksum mean the file is safe?

+

It means the file is identical to the one the checksum describes. If the checksum came from the same server as the file and that server was compromised, both could be malicious. Verify a GPG or Sigstore signature on the checksum list for real assurance.

Can I verify a checksum online without uploading my file?

+

Yes. The encrypt.tools file checksum verifier reads and hashes the file inside your browser using the Web Crypto API, so the file never leaves your computer.

TOOLS IN THIS GUIDE

Tools used in this guide

KEEP READING