How to Check a File's SHA-256 or MD5 Checksum on a Mac

Many download pages show a long string of letters and digits next to the link, labelled SHA-256, sometimes MD5 or SHA-1. It is the file's checksum: a fingerprint computed from every byte of it. Compute the same fingerprint on your Mac, compare the two, and you know whether the file you got is exactly the one the publisher put online.
The short answer:
- In Terminal: type
shasum -a 256and a space, drag the file into the window and press ↩. For MD5, typemd5and a space instead. Then compare the result with the published value. - In Folia Files: select the file and press ⌘I. In the Checksums section, click Compute MD5, SHA-1, SHA-256, SHA-512, then paste the published value into the Paste a checksum to verify field: a green seal means it matches.
The Finder can't help here: its info window shows no checksum, and no menu command computes one.
What a matching checksum tells you
Change a single byte of a file and its checksum changes completely. So when the value you compute is the publisher's, your copy is identical to theirs: it wasn't cut short by a dropped connection, damaged on the way or on the disk, or replaced by something else on a mirror site.
When it doesn't match:
- Check that you compared the same algorithm. An MD5 never equals a SHA-256; they don't even have the same length.
- Check that you have the right file. Many apps offer one download for Apple silicon and another for Intel, each with its own checksum.
- Delete the file and download it again. If it still doesn't match, don't open it, and tell the publisher.
Which algorithm to use
Use the one the publisher gives, and SHA-256 when there is a choice.
- SHA-256: 64 hexadecimal characters, the most common today.
- SHA-512: 128 characters.
- SHA-1 (40 characters) and MD5 (32): still printed for older files. They catch a damaged download perfectly well, but they are no longer considered safe against someone who deliberately builds a different file with the same checksum.
What it doesn't tell you
A checksum shown on the same page as the download can't protect you from a hacked website that changes both. That is what signatures are for: when you first open a downloaded app, macOS checks its developer's signature and Apple's notarization, and some publishers also sign their list of checksums.
In Terminal: shasum and md5
SHA-256, step by step
- Open Terminal, in Applications › Utilities, or type "Terminal" in Spotlight (⌘Space).
- Type
shasum -a 256followed by a space. - Drag the file from the Finder into the Terminal window. Terminal types its full path, with spaces escaped.
- Press ↩. A large file takes a moment: every byte is read.
Terminal prints the checksum, two spaces, then the file:
% shasum -a 256 example.txt
5891b5b522d5df086d0ff0b110fbd9d21bb4fc7163af34d08286a2e846f6be03 example.txt
For the other algorithms, change the number: shasum -a 1 for SHA-1, shasum -a 512 for SHA-512. Don't leave -a out: without it, shasum computes SHA-1, not SHA-256.
MD5
MD5 has its own command, md5. Add -q to get the value alone, ready to copy:
% md5 example.txt
MD5 (example.txt) = b1946ac92492d2347c6235b4d2611184
Let Terminal do the comparing
Comparing 64 characters by eye is error-prone. With -c, shasum compares for you: give it the expected value, two spaces, and the file name.
% echo "5891b5b522d5df086d0ff0b110fbd9d21bb4fc7163af34d08286a2e846f6be03 example.txt" | shasum -a 256 -c
example.txt: OK
If the file differs, the line ends in FAILED, followed by shasum: WARNING: 1 computed checksum did NOT match. Uppercase or lowercase letters don't matter, but a single space instead of two does: shasum then finds no checksum line at all.
Some publishers put their checksums in a file, often called SHA256SUMS, with one line per download. Save it next to the file you downloaded, open Terminal in that folder (here is how to open Terminal in the current folder), and run shasum -a 256 -c --ignore-missing SHA256SUMS: it checks the files you have and skips the others.
For MD5, recent versions of macOS take the expected value after -c: md5 -c b1946ac92492d2347c6235b4d2611184 example.txt. When it doesn't match, the line ends in [ Failed ].
In Folia Files: the Checksums section of Info
Folia Files computes the four checksums in a single read of the file, and compares them for you. It is part of Info, which you get as a window for each item or as a module next to your panes (more on the modules page).
Steps
- Select the file in a pane.
- Press ⌘I (File › Info, also in the right-click menu): a window opens with everything about that file, a picture of it at the top. Or press ⌃⌘I (File › Show Info Module): the Info module shows whatever you select.
- In the Checksums section, click Compute MD5, SHA-1, SHA-256, SHA-512. A progress bar shows while the file is read, in the background: you can keep working.
- The four values appear, each with a copy button at the end of its line. In a narrow window a value is shortened in the middle; the button always copies all of it.
- Under them, paste the publisher's value into the Paste a checksum to verify field. A green seal appears if it matches (Checksum matches), a red cross if it matches none of the four.

The field compares what you paste with all four values, so you don't have to tell it which algorithm it is. Uppercase letters and spaces around the value are fine; paste the value alone, without a label such as "SHA256:" in front.
Good to know
- Files only. Folders have no Checksums section, and neither do apps, which are folders in disguise. Check the disk image (.dmg) or the archive (.zip) you downloaded: that is the file publishers give the checksum of.
- Large files: use the window. The Info module follows the selection, and selecting another file stops the computation. An Info window stays on its file: start it, then go on browsing.
- Files in the cloud. A file that is only in iCloud Drive, or in another cloud, is downloaded in full to be read. A file on a server is read over the network.
- No Checksums in the module? Its gear menu lists the Shown Fields: tick Checksums. The Info window always shows every section.
Are two of your own files the same?
The same fingerprint answers another question: is this copy identical to the original? A file a colleague sent back, a backup on an external drive, an invoice downloaded twice. If the two SHA-256 values match, the content is the same, byte for byte, whatever the names and dates say.
- In Terminal, give
shasum -a 256both files: it prints one line for each, and you compare the two values. - In Folia Files, select both files and press ⌘I: each gets its own Info window. Compute in both, copy the SHA-256 of one and paste it into the field of the other.
In the website edition of Folia Files, the terminal under a pane (⌥⌘T, View › Terminal) opens in the folder you are looking at, so file names are all you type:

To find every identical file in a folder rather than checking pairs, the Duplicate Files tool (in Tools) compares SHA-256 fingerprints the same way, then lets you choose which copy to keep.
