Skip to content
86% off$349 $48.86code BF2026

Guides

How to Check a SHA-256 Checksum on Mac (Terminal and App)

Check a SHA-256 or MD5 checksum on Mac with shasum, md5 or openssl, let Terminal compare it to the published value, and fix a checksum mismatch.

GuideUpdated 8 min read

On this page

To check a SHA-256 checksum on a Mac, open Terminal and type shasum -a 256 (with a space at the end). Then drag the file into the Terminal window and press Return. The 64-character string it prints is the file's SHA-256 checksum.

Don't compare that string to the publisher's value by eye. Use the one-line check under Compare against the published checksum, and the Mac will tell you whether the two values match.

What a checksum proves (and what it doesn't)

A checksum is a fixed-length fingerprint of a file's bytes. If even one byte changes, the SHA-256 value changes completely. If your result matches the value the publisher lists, you have the same file they hashed. That means the download wasn't cut short or corrupted, and you didn't get a different version.

A match does not prove who made the file. Someone who controls the download page can change the file and the listed checksum together. The check is most useful when the checksum comes from a separate source you trust. Examples are a release page, a signed checksum file, or the project's official site when the file itself came from a mirror.

The algorithm matters too:

  • SHA-256 and SHA-512 are the usual choice for verifying downloads.
  • MD5 and SHA-1 still catch accidental corruption. Both have known collision attacks, so don't rely on them to detect deliberate tampering.

Finder has no command that shows checksums. Terminal is the built-in way to get one.

Check a SHA-256 checksum with shasum in Terminal

The shasum command is built into macOS.

  1. Open Terminal. It's in Applications ▸ Utilities, or you can search for it with Spotlight.
  2. Type shasum -a 256 followed by a space.
  3. Drag the file from Finder into the Terminal window. Terminal fills in the full path.
  4. Press Return.
bash
shasum -a 256 ~/Downloads/example.dmg

This prints the SHA-256 checksum, then two spaces, then the file path:

text
3a7bd3e2360a3d29eea436fcfb7e44c735d117c42d1c1835420b6b9942dd4f1b  /Users/you/Downloads/example.dmg

Always include -a 256. Without it, shasum uses SHA-1 and prints a 40-character value, which will never match a published SHA-256.

To print only the checksum, for example in a script:

bash
shasum -a 256 ~/Downloads/example.dmg | awk '{print $1}'

This runs shasum and keeps only the first column of its output.

Get MD5, SHA-1, SHA-512 or other algorithms

Use the same algorithm the publisher used. The length of their value, counted in hex characters, usually tells you which one it is:

AlgorithmHex lengthTerminal command
MD532md5 file
SHA-140shasum -a 1 file
SHA-25664shasum -a 256 file
SHA-38496shasum -a 384 file
SHA-512128shasum -a 512 file

The built-in md5 command prints MD5 (file) = …. Add -q to print only the value:

bash
md5 -q ~/Downloads/example.zip

The openssl command also ships with macOS and produces the same digests:

bash
openssl dgst -sha256 ~/Downloads/example.dmg

This prints the SHA-256 of the file. Replace -sha256 with -sha1, -sha512 or -md5 to use another algorithm. On macOS, the openssl command is LibreSSL, so some options from current OpenSSL releases may be missing. Run openssl version to see which one you have.

shasum and md5 don't do SHA-3, BLAKE2b, CRC32 or xxHash64. If a publisher lists one of those, see Check a file in Bytepliers.

Compare against the published checksum

Comparing 64 characters by eye is slow, and it's easy to miss one wrong character in the middle. Let the Mac do the comparison.

Paste the expected value into shasum -c

shasum -c reads lines in the form <checksum> <file> (with two spaces between them) and reports whether each file matches.

bash
echo "3a7bd3e2360a3d29eea436fcfb7e44c735d117c42d1c1835420b6b9942dd4f1b  example.dmg" | shasum -a 256 -c

Run this from the folder that holds the file (cd ~/Downloads first), or replace example.dmg with the full path. It prints example.dmg: OK when the checksums match and example.dmg: FAILED when they don't. It only reads the file and changes nothing on disk.

Check against a checksum file

Many projects publish a file such as SHA256SUMS that lists checksums for several downloads. Save it in the same folder as your download, then run:

bash
cd ~/Downloads
shasum -a 256 -c SHA256SUMS

Each listed file gets OK or FAILED. Files you didn't download show up as missing. You can ignore those lines, because only the line for your file matters.

Search for the expected value, ignoring case

Some sites publish checksums in uppercase, while shasum prints lowercase. grep -i ignores the difference:

bash
shasum -a 256 ~/Downloads/example.dmg | grep -i 3A7BD3E2360A3D29EEA436FCFB7E44C735D117C42D1C1835420B6B9942DD4F1B

If the checksums match, grep prints the line. If nothing is printed, they don't match.

Check a file in Bytepliers

If you check downloads often, or you'd rather drop a file on a window than type paths, Bytepliers' Hash Generator hashes the file and compares the result in one place. Bytepliers is our developer-utilities app for macOS 14 or later. The hashing runs on your Mac, and the file isn't uploaded anywhere.

Hash Generator File tab with northwind-pos-2.4.1.dmg, its SHA-256 digest and a match under Expected checksum
Paste the published checksum to compare.
  1. Open Bytepliers and press ⌘5 (Command-5) to open Hash Generator.
  2. Click the File tab.
  3. Drop the file onto the pane, or click Choose File….
  4. Paste the published value into Expected checksum.
  5. Read the result: Bytepliers shows whether the value matches or doesn't.

Details that save time:

  • Expected checksum accepts a hex value, a Base64 value, or a whole line copied from a checksum file, in either sha256sum format or BSD format (SHA256 (file) = …). Bytepliers picks the algorithm from the length of what you paste, so you don't have to choose it first.
  • Large files are read in 1 MB chunks, with a progress bar and the elapsed time. Press ⎋ (Escape) or click Cancel to stop.
  • It supports 13 algorithms: MD5, SHA-1, SHA-224, SHA-256 (the default), SHA-384, SHA-512, SHA3-256, SHA3-512, Keccak-256, BLAKE2b-256, CRC32, Adler-32 and xxHash64.
  • Output switches between lowercase hex (the default), uppercase HEX and Base64, so you can show the result in the same form as the publisher's value.
  • Hash Generator inputs aren't saved to Bytepliers' history unless you turn on Also record inputs that look like secrets in Settings ▸ History.

Limits: it hashes one file at a time, and it can't hash folders. If you try, it shows "Folders can't be hashed. Choose a file." It also doesn't do password hashing such as bcrypt, scrypt or Argon2.

Bytepliers is part of MacSuite; you can try it free for 7 days.

Hash text or create an HMAC

Hash a piece of text in Terminal

Use printf, not echo. echo adds a newline at the end, and that newline changes the checksum.

bash
printf '%s' 'hello world' | shasum -a 256

This prints the SHA-256 of exactly hello world, with no trailing newline. For the MD5 of a string, md5 -s 'hello world' does the same.

Create an HMAC in Terminal

An HMAC is a hash combined with a secret key. Services use HMACs to sign webhooks and API requests, so you can confirm a message came from someone who knows the key.

bash
printf '%s' 'message body' | openssl dgst -sha256 -hmac 'your-secret'

This prints the HMAC-SHA256 of the message using that key. The key is saved in your shell history. If that's a problem, delete the history entry afterward or use Bytepliers instead.

Hash text or create an HMAC in Bytepliers

  1. In Hash Generator, stay on the Text tab.
  2. Paste or type the text. A list of digests appears.
  3. For an HMAC, turn on HMAC and enter the key in HMAC key. Choose whether the key is UTF-8, Base64 or Hex.

The HMAC key stays in memory only and is never written to disk. HMAC works with MD5, SHA-1, SHA-2, SHA-3 and Keccak. When you copy a result, Bytepliers marks the clipboard item as concealed, so clipboard managers that honour that marker don't store it.

Hash text with the bytepliers command-line tool

Bytepliers includes a bytepliers command for scripts and pipes. Install it in Settings ▸ Integrations ▸ Command-Line Tool ▸ Install…, and see the command-line tool docs for details.

bash
printf '%s' 'hello world' | bytepliers hash
bytepliers hash -a sha512 'hello world'

The default algorithm is SHA-256. The help text lists md5, sha1, sha256 and sha512 for -a, but the command also accepts the other Hash Generator algorithm names, such as sha3-256, blake2b-256 and xxhash64. It needs an active trial or license, and exits with status 77 without one. It also expects UTF-8 text. For binary files such as DMGs, ZIPs and installers, use shasum or the File tab in the app.

Which method to use

MethodBest forHow it comparesLimits
shasumSHA-1 and SHA-2 on any file, built in-c reports OK or FAILEDNo MD5, SHA-3 or BLAKE2b
md5MD5 of files and strings, built inPipe to grep -iMD5 only
openssl dgstSeveral digests and HMAC, built inPipe to grep -imacOS ships LibreSSL, so some OpenSSL options differ
Bytepliers Hash GeneratorDrag and drop, 13 algorithms, HMACExpected checksum shows match or mismatchOne file at a time, no folders; paid after the 7-day trial
bytepliers hashHashing text in scriptsPipe to grep -iUTF-8 text only, not binary files

If you check a checksum a few times a year, shasum -a 256 -c is all you need. If you check them every week, or you need SHA-3, BLAKE2b or xxHash64, an app is quicker.

If the checksums don't match

  1. Wrong algorithm. Count the characters in the published value. 32 means MD5, 40 means SHA-1, 64 means SHA-256 (or another 256-bit hash), and 128 means SHA-512. Plain shasum without -a 256 gives SHA-1.
  2. Hex compared with Base64. A SHA-256 is 64 characters in hex but 44 characters in Base64, ending in =. Paste the Base64 value straight into Bytepliers' Expected checksum, or set Output to Base64. The Base64 guide covers converting values.
  3. Uppercase vs lowercase. 3A7B… and 3a7b… are the same checksum. Use grep -i or compare in an app.
  4. Wrong file or wrong version. You may have hashed an older copy, or the checksum may be for another build, such as the Apple silicon download instead of the Intel one. Check the file name and version on the download page.
  5. Incomplete or corrupted download. Delete the file, download it again from the official source, and hash it again.
  6. Invisible differences in text. When you hash a string, a trailing newline, Windows line endings or a different text encoding all change the result. Use printf '%s' rather than echo.

If the file still doesn't match after a fresh download from the official site, don't open it. Report the mismatch to the publisher and include the file name, where you downloaded it, the algorithm, and both values.

FAQ

How do I check the checksum of every file in a folder? Run find /path/to/folder -type f -exec shasum -a 256 {} + > ~/checksums.txt in Terminal. This writes a SHA-256 line for every file in the folder and its subfolders to checksums.txt in your home folder. To recheck every file later, run shasum -a 256 -c ~/checksums.txt.

Is MD5 good enough to verify a download? MD5 is fine for catching accidental corruption. It isn't enough against deliberate tampering, because someone can forge two files with the same MD5 value. Use SHA-256 whenever the publisher offers it.

Does checking a checksum replace macOS security checks? No. A checksum confirms you have the exact file the publisher hashed. Gatekeeper and notarization check that an app is signed by an identified developer and has been checked by Apple. They answer different questions, so use both.

For certificate fingerprints, which are also SHA-256 and SHA-1 values, see how to view SSL certificate details on Mac. The Bytepliers tool reference lists every Bytepliers tool.

Every app.
One purchase.