Learn how to verify a downloaded file with SHA-256 or another checksum using built-in Windows, macOS, and Linux commands. This reusable checklist covers finding an official hash, calculating your local value, comparing results, investigating mismatches, and knowing when a digital signature provides stronger assurance.
Overview
A file hash is a fixed-length value calculated from a file’s contents. If even a small part of the file changes, its hash will usually change as well. Comparing your locally calculated hash with a value published by the software vendor or project is a practical way to check whether a download is intact.
The most common choice for modern software downloads is SHA-256. You may also see SHA-512, SHA-1, MD5, or another algorithm. The algorithm matters because two hashes can only be compared when they were generated with the same algorithm. A SHA-256 value is not comparable to an MD5 value, even when both describe the same file.
Checksum verification answers an important but limited question: “Does my file produce the expected hash?” It does not automatically prove that the website, mirror, or published checksum was trustworthy. For higher-risk downloads, look for a digital signature, a signed release file, or checksums distributed through a separately protected project channel. Hashing and signing are related security utilities, but they solve different parts of the verification problem.
Common hash algorithms
| Algorithm | Typical use | Practical guidance |
|---|---|---|
| SHA-256 | Software releases, installers, archives, deployment artifacts | A strong general-purpose choice when the publisher provides it. |
| SHA-512 | Release verification and security workflows | Use it when the official instructions publish a SHA-512 value. |
| SHA-1 | Legacy systems and older release documentation | Do not substitute it for a stronger algorithm when one is available. |
| MD5 | Basic corruption checks in older workflows | Useful only when appropriate to the publisher’s stated purpose; it is not a modern authenticity guarantee. |
Checklist by scenario
Before installing a desktop application or archive
- Use the official download page. Confirm the domain, product name, release version, operating system, and CPU architecture. Avoid relying on a search result alone when a project provides a known release page.
- Record the exact filename. A checksum belongs to a particular file. Differences in version, installer format, compression, or architecture produce different hashes.
- Find the matching checksum. Look for a SHA-256 or SHA-512 value in the release notes, download page, checksum file, or official documentation. Note the algorithm and make sure the value corresponds to your filename.
- Calculate the local hash. Use a command below or a trusted local utility. Online hash generators can be convenient for non-sensitive files, but uploading an installer, private archive, or deployment artifact to a website may disclose it.
- Compare the complete values. Compare character by character, preferably by copying both values into a plain-text editor or using a command-line comparison. Do not rely only on the first few characters.
- Make a decision. An exact match supports proceeding. A mismatch means you should stop, preserve the file if an investigation is needed, and troubleshoot before opening or installing it.
Windows
In PowerShell, use Get-FileHash with the file path and algorithm:
Get-FileHash -Path .\installer.exe -Algorithm SHA256
The output includes the path, algorithm, and hash. For SHA-512, change SHA256 to SHA512. Windows also includes the Command Prompt utility certutil:
certutil -hashfile installer.exe SHA256
If the path contains spaces, surround it with quotation marks. You can also drag a file into a terminal window in many desktop configurations to insert its path, then check that the resulting command points to the intended file.
macOS
For SHA-256, open Terminal and run:
shasum -a 256 ~/Downloads/installer.dmg
For SHA-512, use shasum -a 512. If an older project supplies an MD5 value, the corresponding command is:
md5 ~/Downloads/installer.dmg
Use the full path or drag the file into Terminal after typing the command and a space. This reduces errors caused by filenames containing spaces or punctuation.
Linux
Most Linux distributions provide the GNU coreutils hash commands. For SHA-256, run:
sha256sum ./package.tar.gz
For SHA-512, use:
sha512sum ./package.tar.gz
Some projects publish a checksum file that can be checked directly. If SHA256SUMS contains a filename and expected value in the standard format, run:
sha256sum --check SHA256SUMS
Review the output carefully. A successful result applies only to the files and paths represented in that checksum file.
For a build artifact or deployment package
Verify the artifact immediately after downloading it and again after copying it into a release or deployment location. Record the filename, hash algorithm, expected value, source URL, release identifier, and verification time in the deployment notes. This creates a small audit trail without requiring a complex workflow. For container-based delivery, pair artifact verification with image and Dockerfile review; the Dockerfile best practices guide covers related build and supply-chain checks.
What to double-check
- Algorithm: Confirm that both values use SHA-256, SHA-512, or the exact algorithm named by the publisher.
- Filename: Check version, platform, architecture, extension, and compression format. A checksum for a Linux archive will not match a Windows installer.
- Character accuracy: Hashes are commonly shown as hexadecimal strings. A missing, added, or transposed character makes the comparison fail.
- Source of the expected value: Prefer a checksum published through the project’s official release process. Treat an unexpected value copied from an unrelated forum or mirror with caution.
- File location: Make sure your command points to the file you intend to verify rather than an older download with a similar name.
- Signature options: If the project provides a signed checksum file or package signature, follow its official verification instructions. A matching hash alone does not establish who published the file.
Checksum verification is different from encoding. Base64 changes how data is represented and can be reversed; hashing is designed to produce a one-way comparison value. For a broader explanation, see the Base64, URL encoding, and hashing comparison guide. Similarly, decoding a JWT can help inspect token contents, but it does not verify a downloaded file or validate a token’s signature; see the JWT decoder guide for that separate workflow.
Common mistakes
Checking only a partial hash
Short prefixes are easier to read but provide a weaker comparison. Use the full published value whenever possible. If a website displays a truncated value, find the project’s complete checksum file or release instructions before treating the check as conclusive.
Using the wrong download
Browsers and package tools may retain several versions in the same folder. Sort by filename or date, and calculate the hash of the exact file named in the official release information. Renaming a file does not change its hash, but downloading a different build does.
Assuming a mismatch always means malware
A mismatch can result from an interrupted download, a stale checksum, a different release build, a proxy or mirror problem, or a simple filename error. Do not install the file while the discrepancy is unresolved, but investigate methodically rather than jumping to a conclusion.
Continuing after a mismatch
Download the file again from the official source, confirm the release and architecture, and recalculate the value. If it still differs, check the project’s release notes or contact the maintainer through an official channel. Do not “fix” the expected value by replacing it with the hash you calculated.
Uploading sensitive files to an online hash tool
An online hashing utility may be suitable for a public, non-sensitive file, but local commands are safer for confidential source code, credentials, customer exports, private archives, and proprietary builds. Keep verification local when the file itself should not leave your system.
When to revisit
Return to this checklist whenever you install a new release, download a command-line tool, copy a deployment artifact, or investigate a file that behaves differently from expectations. Recheck the workflow when a project changes its release format, begins publishing signed files, moves to a new hosting or mirror arrangement, or changes its documented hash algorithm.
It is also worth reviewing your commands before a seasonal planning cycle, a major operating-system upgrade, or a change in team tooling. Built-in commands are generally stable, but paths, shell syntax, package formats, and project instructions can change. Keep a short team procedure that answers four questions: where the official checksum is found, which algorithm is required, which command is used on each operating system, and what happens after a mismatch.
Action checklist: download from the official source; record the exact filename and release; locate the matching official checksum; calculate it locally with the correct algorithm; compare the complete value; and stop for investigation if it does not match. For higher-risk software, add signature verification and document the result alongside the release or deployment record.