How to Check MD5 (or SHA 256) on a Mac

Verify an MD5 (or SHA) Checksum on a Mac

Want to check a file you downloaded for tampering? Want to verify a file on your system? Find out here how to check and verify an MD5 checksum on a Mac (as well as SHA, RIPMD or Whirlpool hashes, for example) using “md5”, “shasum” and “openssl”.

First, Mix 5 Parts Strong Instant Coffee and 3½ Parts Washing Soda

Add water to the coffee-soda mix, of course, and some vitamin C concentrate if you please.

You’ve just made a developing agent for black and white film—caffenol-c.

Now that we know how to transform film negatives into pictures to hang on the wall with nothing but a trip to the supermarket, how about transforming any file into a hash code you can verify with nothing but a trip to macOS?

How to Check an MD5 Checksum on a Mac

On Windows? How to Verify an MD5 (or SHA) Checksum on Windows 10/11
On Linux? How to Verify an MD5 or SHA Checksum on Linux

Time needed: 2 minutes

To generate and verify the MD5 checksum for a file or document on a Mac using macOS:

  1. Open Terminal.

  2. Navigate to the folder that contains the file whose MD5 checksum you want to verify.

    The direct route: You can open Terminal right at a folder from Finder.

  3. Type md5 <file>.

    Dragging and dropping: You can also type md5 , then drag and drop the file you want to check onto the Terminal window.

  4. Press Enter.

    Verify an MD5 file checksum on a Mac

How to Check SHA (SHA-1 and SHA-2/SHA 256) on a Mac

To check the SHA-1 checksum for any file on a Mac:

  1. Open Terminal
  2. Go to the folder that contains the file whose SHA checksum you want to check.
    The speedy way: See above for fast folder navigation.
  3. Type shasum <file>.
    Different hashing function: Use shasum -a <algorithm> <file>, replacing <algorithm> with the desired function from the table below.
    SHA-2 checksum example: Type shasum -a 256 Example.txt to generate the SHA-2 256-bit checksum for the file Example.txt.
  4. Press Enter.
    Verify a SHA (SHA-512) file checksum on a Mac using Terminal
CommandHashing FunctionOutput
1SHA-1 secure hash algorithm 1 (160 bit)40 digits
640ab2bae07bedc4c163f679a746f7ab7fb5d1fa
224SHA-2 224-bit secure hash algorithm56 digits
3606346815fd4d491a92649905a40da025d8cf15f095136b19f37923
256SHA-2 256-bit secure hash algorithm64 digits
532eaabd9574880dbf76b9b8cc00832c20a6ec113d682299550d7a6e0f345e25
384SHA-2 384-bit secure hash algorithm96 digits
7b8f4654076b80eb963911f19cfad1aaf4285ed48e826f6cde1b01a79aa73fadb5446e667fc4f90417782c91270540f3
512SHA-2 512-bit secure hash algorithm128 digits
c6ee9e33cf5c6715a1d148fd73f7318884b41adcb916021e2bc0e800a5c5dd97f5142178f6ae88c8fdd98e1afb0ce4c8d2c54b5f37b30b7da1997bb33b0b8a31
512224SHA-512/224 truncated 512-bit secure hash algorithm56 digits
c696f08d2858549cfe0929bb7b098cfa9b64d51bec94aa68471688e4
512256SHA-512/256 truncated 512-bit secure hash algorithm64 digits
bbd4c3ba8083657894efee31469b2bc43510f95f4ca81fe3045905e804aee90c

Speaking of “hashing”: Where to Find the Hash Key ( # ) on a Mac Keyboard

How to Verify an MD5 Checksum on a Mac: FAQ

How can I quickly check the generated sum against the expected sum?

You can use diff to compare the computed output against the known expected checksum:

diff <(md5 Example.txt) Example.txt.md5sum 

Can I generate RIPEMD or Whirlpool checksums on a Mac?

Yes.

Using OpenSSL, you can generate checksums using a host of alternative hashing functions.

To verify MD5, SHA and other checksums using OpenSSL on a Mac:

  1. Open Terminal.
  2. Go to the folder that contains the file whose checksum you want to verify.
  3. Type openssl <algorithm> <file> (replacing <algorithm> with the algorithm from the table below and <file> with the filename).
    RIPEMD checksum example: Type openssl ripemd160 Example.txt for the RIPEMD160 checksum for Example.txt.
  4. Press Enter.
    Verify a RIPE MD 160 file checksum on a Mac in Terminal
CommandHashing FunctionOutput
md4Message-digest algorithm 4 128-bit32 digits
5d9381b52cd41a87bc8fcc7726aec03a
md5Message-digest algorithm 5 128-bit32 digits
0cbc6611f5540bd0809a388dc95a615b
sha1SHA-1 secure hash algorithm 1 (160 bit)40 digits
640ab2bae07bedc4c163f679a746f7ab7fb5d1fa
sha224SHA-2 224-bit secure hash algorithm56 digits
3606346815fd4d491a92649905a40da025d8cf15f095136b19f37923
sha256SHA-2 256-bit secure hash algorithm64 digits
532eaabd9574880dbf76b9b8cc00832c20a6ec113d682299550d7a6e0f345e25
sha384SHA-2 384-bit secure hash algorithm96 digits
7b8f4654076b80eb963911f19cfad1aaf4285ed48e826f6cde1b01a79aa73fadb5446e667fc4f90417782c91270540f3
sha512SHA-2 512-bit secure hash algorithm128 digits
c6ee9e33cf5c6715a1d148fd73f7318884b41adcb916021e2bc0e800a5c5dd97f5142178f6ae88c8fdd98e1afb0ce4c8d2c54b5f37b30b7da1997bb33b0b8a31
streebog256GOST R 34.11-2012 streebog 256-bit hash function64 digits
3ebeae08f0adb274a578960a5fa71a9b561cb7659f2470fa5c86ae0df7275713
streebog512GOST R 34.11-2012 streebog 512-bit hash function128 digits
823b923c466cba8969f74e6735be91b7a812474dec2c344bc1aa4dea61b7c379ef196b43d4aba5ebdc0b6ad3ab9d021f35ba2e6fe9fd099b9c4a1ac36095e146
ripemd160RIPE Message Digest 160-bit40 digits
76c82682cd7af7e812e513fa0e7914ab40b842e0
gost-macGOST 28147 MAC algorithm8 digits
52efa915
md_gost94GOST R 34.11-94 hash function64 digits
a0b1e053dd3f177d90c7989ebf6db7aa3c963b2267b7d542a20476cc3e33a3f1
whirlpoolWhirlpool 512-bit hash function128 digits
ac1c196e84b05d59faea639d0cccb6c16f7568e0943f4c94c648bd8eefe5cf3978f8d4f99b1426e4ce3c6fa40e17cf68d6b86d42246333569b963ff4579c6355

(How to check MD5o on a Mac tested with macOS Sonoma 14.3, Ventura 13.4, Monterey 12.3 and Big Sur 11.3; updated March 2024)

Home » Mac Tips and Resources » How to Check MD5 (or SHA 256) on a Mac