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

Guides

Check the SHA-256 Hash of a File on Mac (and Compare It)

Check a file's SHA-256 on a Mac with shasum, openssl or Bytepliers, compare it to the published checksum, and avoid the echo newline trap with text.

GuideUpdated 7 min read

On this page

You downloaded a file, the publisher lists a SHA-256, and you want to know whether they match. Or you hashed a string and got a different value than the website did. Both come down to hashing exactly the bytes the publisher hashed, then comparing without eyeballing 64 characters.

Why hashes don't match

A SHA-256 digest depends on every byte of the input. Change one byte and you get an unrelated result. The usual causes, most common first:

  • A newline in text hashing. echo ends its output with a newline, and that newline is part of what gets hashed.
  • A bad or incomplete download. The file on disk is not the file the publisher hashed.
  • A different algorithm. A SHA-256 hex digest is 64 characters. 128 characters means SHA-512, and 40 means SHA-1.
  • The wrong file. A different version, or the Intel build instead of the Apple silicon build.
  • Stray characters in what you pasted. Quotes, spaces or line breaks around the published value.
  • A stale published checksum. Publishers sometimes replace a file and forget to update the number.

Check a file in Terminal

With shasum

  1. Open Terminal (search for it in Spotlight).
  2. Type shasum -a 256 with a trailing space.
  3. Drag the file from Finder into the Terminal window. Apple's Terminal guide says the item's absolute path appears on the command line, so you don't type the path or escape spaces yourself (Apple Support: drag items into a Terminal window).
  4. Press Return.
bash
shasum -a 256 ~/Downloads/example.dmg

This prints the digest followed by the file name. It only reads the file, so there is nothing to undo. Homebrew's own documentation uses the same command to calculate the SHA-256 of a downloaded file (Homebrew checksum requirements).

With openssl

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

The output looks like SHA256(<path>)= <hash>. Hex case doesn't matter when you compare.

Compare against the published checksum without eyeballing it

If the publisher provides a checksum file, put it in the same folder as the download and let shasum check it. Microsoft's .NET install page documents this pattern, including the FAILED result you get on a mismatch (Microsoft Learn: install .NET on macOS).

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

Each line is checked against the file of that name and reports OK or FAILED. Lines for files you didn't download will error; look at the line for your file.

If you only have the hash from a web page, build the line yourself. Two spaces separate the hash from the file name:

bash
cd ~/Downloads
echo "PASTE_THE_PUBLISHED_HASH_HERE  example.dmg" | shasum -a 256 -c -

If the publisher gives Base64 instead of hex, print the file's digest in Base64 and compare the strings:

bash
openssl dgst -sha256 -binary ~/Downloads/example.dmg | base64

Check the SHA-256 of text (the newline trap)

bash
echo "simple text" | shasum -a 256         # hashes "simple text" plus a newline
echo -n "simple text" | shasum -a 256      # hashes "simple text" only
printf '%s' 'simple text' | shasum -a 256  # same, and behaves the same in any shell

printf '%s' is the safest because its behavior doesn't vary between shells. Single quotes stop the shell from interpreting characters like ! or $. Extra spaces, a trailing line break and different capitalization each change the hash.

Check a SHA-256 in Bytepliers

The Terminal route works, but you build the comparison yourself. The Hash Generator in Bytepliers lets you drop a file, paste the published checksum and see a match or mismatch. Hashing happens on your Mac; the tools make no network calls.

Hash a file and compare it

  1. Open Bytepliers and press ⌘5 (Command-5) to open Hash Generator. You can also pick it from the sidebar or the ⌘K command bar.
  2. Select the File tab.
  3. Drop the file onto it, or click Open File… / Choose File… (⌘O).
  4. Wait for the progress bar. The file is streamed in 1 MB chunks, with elapsed time shown. Press ⎋ (Escape) or click Cancel to stop.
  5. Read the digest. SHA-256 is the default algorithm and hex is the default output.
  6. Paste the published checksum into Expected checksum. Bytepliers shows a match or a mismatch.

The field accepts a hex digest, a Base64 digest, or a whole line from a sha256sum or BSD-style checksum file. The algorithm is picked from the length of what you paste, so you don't have to work out which algorithm a long string belongs to.

The File tab takes one file at a time. Folders can't be hashed ("Folders can't be hashed. Choose a file."). Use Choose Another… or Remove to switch files.

Hash text

  1. Open Hash Generator (⌘5) and stay on the Text tab, the default.
  2. Paste or type the text in the input pane.
  3. Read the digest. The list shows the encoding ("UTF-8") and the output format.

No shell is involved, so no echo adds a newline. Make sure the pane holds exactly the text the publisher hashed, including whether it ends in a line break.

Other algorithms, HMAC and output format

Hash Generator offers 13 algorithms: MD5, SHA-1, SHA-224, SHA-256 (default), SHA-384, SHA-512, SHA3-256, SHA3-512, Keccak-256, BLAKE2b-256, CRC32, Adler-32 and xxHash64. Output can be hex (default), uppercase hex or Base64. The HMAC toggle adds an HMAC key (UTF-8, Base64 or Hex, kept in memory only) for MD5, SHA-1, SHA-2, SHA-3 and Keccak. There is no password hashing such as bcrypt, scrypt or Argon2.

The command line: bytepliers hash

After installing the command-line tool (Settings ▸ Integrations ▸ Command-Line Tool ▸ Install…) you can hash text in scripts:

bash
bytepliers hash "simple text"
bytepliers hash -a sha512 "simple text"

The default is SHA-256. Input can be text arguments, -i <file> or piped stdin, and a trailing newline from stdin or a file is dropped unless you add --raw. The CLI reads input as UTF-8 text and refuses files over 100 MB, so it can't hash a typical binary download such as a DMG. For downloads use the File tab or shasum. It also needs a license or active trial, and you must open Bytepliers once to enable it. See the command-line page.

Which method to use

MethodGood forLimit
shasum -a 256Quick checks, scripts, -c against a checksum fileYou build the comparison yourself
openssl dgst -sha256Same job; -binary piped to base64Output is SHA256(name)= hash
Bytepliers File tabPaste the published value, see match or mismatchNeeds the app; one file at a time
Bytepliers Text tabText with no shell quoting or newlineHashes exactly what is in the pane
bytepliers hashHashing text in scriptsUTF-8 text only; not for binaries

If you check a hash now and then and know Terminal, the built-in commands are enough. Bytepliers helps if you compare checksums often or want a paste-and-compare field that works out the algorithm.

Checklist before you trust a mismatch

  • The algorithm matches: 64 hex characters for SHA-256.
  • You hashed the file from the same release and architecture as the checksum.
  • You pasted only the hash, or the whole hash filename line, with no quotes.
  • Text hashes used printf '%s' or echo -n, not plain echo.
  • You re-downloaded the file, ideally from the same server as the checksum.

If nothing works

If a re-download still fails and a second tool agrees with your hash, the published value may be stale. Contact the software's publisher with the file name, version, the checksum they list, the one you computed, the tool you used and the download URL. A package manager reporting a mismatch is the same kind of problem; people have reported Homebrew rejecting a hash that a separate hashing app then confirmed as different. Find out which side is wrong before bypassing the check.

text
Hello, the SHA-256 for <file name> (<version>, <Intel or Apple silicon>) on your download page is <published hash>.
I downloaded it from <URL> on <date> and got <my hash> using shasum -a 256.
I re-downloaded it and got the same result. Is the published checksum current?

For Bytepliers questions, use support.

Common questions

Does the hash change if I rename the file?

No. SHA-256 covers the contents, not the name or location.

Are uppercase and lowercase hex the same?

Yes. They are the same number written two ways. Case only matters in a case-sensitive string comparison.

Can I get the SHA-256 of a whole folder?

Not directly. shasum and Bytepliers hash single files. You can hash an archive of the folder, but two archives of the same folder can differ, so only compare hashes of the same archive file.

Can Disk Utility verify a disk image?

It can verify a disk image's internal checksum (Images > Verify, per Apple's Disk Utility guide). That checks the image against its own stored value, not against a SHA-256 the publisher lists.

Bytepliers is part of MacSuite ($349 one-time as of November 2026), with a 7-day free trial. See pricing.

Every app.
One purchase.