How-To Guide

    How to Check a SHA-256 Checksum on Mac

    macOS has the tool built in. Here is the one command that prints a file's SHA-256, how to check it against a published hash without comparing 64 characters by eye, and the MD5 and whole-folder versions.

    Published November 21, 2026Updated November 21, 20267 min read
    Mehrab Ali

    Author

    Mehrab Ali

    Founder & Executive Lead, ARCED International

    Founder of ARCED Foundation, ARCED International, and Solutions of Things Lab (SoTLab). Built FolderManifest to help teams protect file integrity and stay audit-ready.

    Quick Answer

    To check a SHA-256 checksum on a Mac, open Terminal and run shasum -a 256 /path/to/file. It prints a 64-character hash; if it matches the one the publisher lists, the file is intact. shasum ships with macOS on both Apple Silicon and Intel Macs, so there is nothing to install. For MD5, the command is md5 /path/to/file.

    The rest of this guide covers the parts people trip over: letting the Mac do the comparison for you, checking a SHA256SUMS file, the -a 256 that is easy to forget, and hashing a whole folder.

    Get the SHA-256 of a File on Mac

    1. Open Terminal (Applications > Utilities, or press Command-Space and type Terminal).
    2. Type shasum -a 256 and a space.
    3. Drag the file from Finder into the Terminal window. macOS fills in the full path, with any spaces escaped for you.
    4. Press Return.
    $ shasum -a 256 ~/Downloads/installer.dmg
    5891b5b522d5df086d0ff0b110fbd9d21bb4fc7163af34d08286a2e846f6be03  /Users/you/Downloads/installer.dmg

    The first 64 characters are the SHA-256 hash. Everything after the two spaces is the file path. A large disk image can take a few seconds, because every byte of the file is read.

    Two variations that save time:

    # Several files at once
    shasum -a 256 installer.dmg notes.pdf photo.heic
    
    # Copy just the hash to the clipboard
    shasum -a 256 installer.dmg | awk '{print $1}' | pbcopy

    Do not leave off -a 256

    Plain shasum file computes SHA-1, which is 40 characters long, and it will never match a published SHA-256. If your hash looks too short, this is why.

    Check the File Against a Published Hash

    Comparing two 64-character strings by eye is slow and easy to get wrong. Let shasum do it. Copy the hash from the publisher's download page, cd to the folder that holds the file, and pipe a line in the form hash, two spaces, file name into shasum -c:

    cd ~/Downloads
    echo "5891b5b522d5df086d0ff0b110fbd9d21bb4fc7163af34d08286a2e846f6be03  installer.dmg" | shasum -a 256 -c

    A good file prints:

    installer.dmg: OK

    A damaged or altered file prints:

    installer.dmg: FAILED
    shasum: WARNING: 1 computed checksum did NOT match

    Things to know about this check:

    • There must be two spaces between the hash and the file name. With one space, shasum answers no properly formatted SHA checksum lines found.
    • Case does not matter here. A hash published in uppercase (common on Windows-oriented sites) still verifies with -c.
    • FAILED means do not open the file. Delete it and download it again from the official source. If it fails twice, the published hash may be for a different version or build (Apple Silicon and Intel downloads have different hashes).

    Prefer a plain yes or no in a script? Compare the strings directly. This form is case-sensitive, so paste the expected hash in lowercase:

    expected="5891b5b522d5df086d0ff0b110fbd9d21bb4fc7163af34d08286a2e846f6be03"
    actual="$(shasum -a 256 installer.dmg | awk '{print $1}')"
    [ "$actual" = "$expected" ] && echo "MATCH" || echo "MISMATCH"

    Verify a SHA256SUMS or .sha256 File

    Many projects publish a text file next to their downloads, named something like SHA256SUMS or installer.dmg.sha256. Each line is a hash and a file name. Put it in the same folder as the download and run:

    shasum -a 256 -c SHA256SUMS

    A SHA256SUMS file usually lists every download for a release, and you probably have only one of them. The files you do not have are reported as failed to open, which buries the line you care about. Check only your file instead:

    grep "installer.dmg" SHA256SUMS | shasum -a 256 -c

    These checksum files are the same format that sha256sum writes on Linux, so a list made on Linux verifies on a Mac and the other way round. See our sha256sum guide for Linux for that side.

    MD5, SHA-1, and SHA-512 on Mac

    Some older downloads still list an MD5. macOS has a separate md5 command for that, and shasum covers the rest of the SHA family through the -a option.

    HashMac commandLength
    MD5md5 file32 characters
    SHA-1shasum file or shasum -a 1 file40 characters
    SHA-256shasum -a 256 file64 characters
    SHA-512shasum -a 512 file128 characters

    md5 prints in its own layout, with the hash last:

    $ md5 installer.dmg
    MD5 (installer.dmg) = b1946ac92492d2347c6235b4d2611184
    
    # Only the hash
    $ md5 -q installer.dmg
    b1946ac92492d2347c6235b4d2611184
    
    # Hash first, then the name (close to md5sum on Linux)
    $ md5 -r installer.dmg
    b1946ac92492d2347c6235b4d2611184 installer.dmg

    MD5 still catches a broken download, but it cannot prove a file was not deliberately altered. When a publisher offers both, use SHA-256. MD5 vs SHA-256 explains when the difference matters. On a PC instead? See md5sum on Windows.

    Hashing text instead of a file

    Use printf '%s' 'hello' | shasum -a 256, not echo. echo adds a line break to the end of the text, and that one extra byte produces a completely different hash from the one other tools report for the same word.

    Other Built-In Options: openssl and sha256sum

    openssl is also preinstalled and prints the same hash in a different layout. It is handy if you already know it from other systems:

    $ openssl dgst -sha256 installer.dmg
    SHA256(installer.dmg)= 5891b5b522d5df086d0ff0b110fbd9d21bb4fc7163af34d08286a2e846f6be03

    If you follow instructions written for Linux, you will see sha256sum instead. Whether your Mac has that command depends on the macOS version and on what you have installed, so check before relying on it:

    # Prints a path if the command exists, nothing if it does not
    command -v sha256sum
    
    # No result? This is the same thing on every Mac:
    shasum -a 256 installer.dmg

    Homebrew users can run brew install coreutils to get the GNU tools. Homebrew installs them with a g prefix, so the commands are gsha256sum and gmd5sum. For checking a download there is no advantage over shasum: the hash is identical.

    Hash Every File in a Folder

    To record a checksum for every file in a folder and its subfolders, combine find with shasum. Run this from inside the folder:

    cd /path/to/folder
    find . -type f ! -name .DS_Store -exec shasum -a 256 {} + > ../checksums.sha256
    • ! -name .DS_Store skips the hidden files Finder creates. They change whenever you open a folder and would show up as false failures later.
    • The list is written one level up (../) so the checksum file does not end up hashing itself.
    • File names with spaces are handled correctly.

    Later, or on a copy of the folder, check every file against that list and show only the problems:

    cd /path/to/folder-or-its-copy
    shasum -a 256 -c ../checksums.sha256 | grep -v ': OK
    #x27;

    No output means every listed file is present and unchanged. One limit to keep in mind: this only checks files that are in the list. A file that was added to the folder afterwards is not reported at all.

    Check a Checksum on Mac Without Terminal

    Finder has no checksum option in Get Info or the right-click menu. You have two practical choices.

    For small files, use the free Checksum Calculator. It takes a file up to 10 MB and shows SHA-256, MD5, SHA-1, and CRC32. The file is uploaded, hashed in memory, and not stored. Most disk images and installers are larger than 10 MB, so for those use Terminal.

    For a right-click option in Finder, make a Quick Action once:

    1. Open Automator and create a new Quick Action.
    2. Set Workflow receives current to files or folders in Finder.
    3. Add the Run Shell Script action and set Pass input to as arguments.
    4. Replace the script with the line below and save it as “SHA-256 to Clipboard”.
    shasum -a 256 "$@" | pbcopy

    Right-click any file, choose Quick Actions, then your action. The hash and file path are copied to the clipboard, ready to paste next to the published value.

    Checking a Whole Folder Copy, Not One Download

    shasum answers one question well: does this file match that hash? Moving a photo library to a new Mac, copying a project to an external drive, or restoring a backup raises a bigger one. Which files are missing, which are extra, and which changed? The find recipe above covers part of it, but it will not tell you about extra files, and you have to keep the list yourself.

    FolderManifest records every file in a folder with its path, size, dates, and SHA-256 hash, then compares a second folder or a later scan against that record and reports what was added, removed, or changed. It runs locally on macOS (Apple Silicon and Intel), Windows 10/11, and Linux. It uses SHA-256 only, so it does not replace md5 when a publisher lists just an MD5.

    You may not need it

    To check one download against a published hash, shasum -a 256 is all you need. A manifest is worth it when you have to confirm that thousands of files arrived intact, or re-check the same folder months later.

    Frequently Asked Questions

    How do I check the SHA-256 of a file on Mac?

    Open Terminal, type shasum -a 256 followed by a space, drag the file into the window, and press Return. Terminal prints a 64-character hash followed by the file path. shasum is included with macOS, so there is nothing to install.

    Does macOS have sha256sum?

    Not reliably. The command macOS has always shipped for this is shasum -a 256, which prints the same hash. Run command -v sha256sum to see whether your Mac has it. If it prints nothing, use shasum -a 256, or install GNU coreutils with Homebrew, which adds it under the name gsha256sum.

    What is the md5sum equivalent on Mac?

    md5. Run md5 file.dmg to print the MD5 hash, md5 -q file.dmg to print only the hash, or md5 -r file.dmg to print the hash first and the file name second, which is close to md5sum output.

    Why does shasum give me a 40-character hash instead of 64?

    You left off -a 256. Without the -a option shasum computes SHA-1, which is 40 hexadecimal characters. A SHA-256 hash is always 64 characters. Run shasum -a 256 file to get it.

    Why does shasum -c say no properly formatted SHA checksum lines found?

    The line you gave it is not in the format shasum expects: the hash, then two spaces, then the file name. One space is not enough. The same error appears if the checksum file was saved with Windows line endings or contains other text around the hash.

    Can I check a checksum on Mac without Terminal?

    macOS has no built-in checksum window in Finder. For files up to 10 MB, the free FolderManifest Checksum Calculator works in a browser. For larger files such as disk images, Terminal is the practical route, or you can add a Finder Quick Action that runs shasum for you.

    If the SHA-256 matches, is the file safe?

    A match proves your copy is byte-for-byte identical to the file the publisher hashed, so the download was not corrupted or swapped along the way. It does not prove the publisher’s file is trustworthy. Get the hash from the publisher’s official site, not from the same mirror you downloaded from.

    Verify a Whole Folder on Your Mac, Not Just One File

    Record every file with its SHA-256 hash, then check any copy or backup against it. Native on Apple Silicon and Intel, plus Windows and Linux. 7-day free trial, no card required, 30-day money-back guarantee.

    Continue Learning