Generate a SHA256 hash on Mac by running shasum -a 256 /path/to/file, or by hashing the exact bytes in a local browser tool. A SHA-256 digest is always 32 bytes, displayed as 64 lowercase hexadecimal characters or as standard padded Base64.
Use a hash to check whether two byte sequences are identical, such as a downloaded installer and a copy supplied by its publisher. Hashing is not encryption: it does not hide the input, use a key, or prove who created the input. The browser workflow below calculates in the current tab and does not upload the selected content.

Generate a SHA-256 Hash on Mac
- Open Terminal. Go to Applications > Utilities > Terminal, or open Spotlight and search for Terminal.
- Enter the SHA-256 command with the file path. Run shasum -a 256 /path/to/file. Replace the example path with the real one. If the path contains spaces, quote it, for example shasum -a 256 "/path/to/My Download.dmg". You can also drag the file into the Terminal window to insert its path.
- Press Return and read the result. The output line contains a 64-character hexadecimal digest followed by the filename. The digest is the first field; the filename is context, not part of the hash.
- Copy and compare the complete digest. Select the full 64-character value, copy it, and compare it with the expected checksum from an authenticated source. A matching prefix is not a complete verification.
macOS includes the shasum utility, so a file digest can be produced locally without an online service. For a text file, hash the saved file itself rather than retyping its contents. Do not use an echo command to recreate the file for comparison because it normally appends a newline.
Hash Text or Files on Mac in the Browser
The SHA256 Hash Generator offers a second local workflow. It hashes UTF-8 text or a local file with the browser cryptography implementation, then shows the same digest as lowercase Hex or standard padded Base64.
- Select Text or File mode. Use Text for a string that will be encoded as UTF-8, or File for the exact bytes of a local download.
- Preserve the content exactly. Paste text without trimming spaces or a final newline, and review the displayed byte count. For a file, select the file itself; file mode includes every byte, including headers, embedded metadata, and line-ending bytes.
- Generate the SHA-256 value and copy the needed representation. Choose the full 64-character Hex value or the standard padded Base64 value expected by the other system.
- Compare complete outputs from the same bytes. Confirm that the browser and reference hashed the same content before treating a match as meaningful.
Files up to 100 MB are supported. Because the calculation stays in the current browser tab, the selected text or file content is not uploaded.
Match the Output Format Required by the Verifier
SHA-256 is the 256-bit algorithm in the SHA-2 family defined by NIST FIPS 180-4. The two generator outputs are different encodings of one 32-byte digest, not two different hashes.
| Representation | Exact format | Choose it when |
|---|---|---|
| Hex | 64 lowercase characters; two characters represent each digest byte | A checksum list, manifest, or system expects hexadecimal |
| Base64 | 44-character standard padded encoding of the same 32 bytes | A system expects the digest carried as Base64 |
Copy the representation named by the receiving system. Uppercase and lowercase Hex letters are only presentation differences and do not change the underlying digest bytes. When storing a checksum, record “SHA-256” beside it so a 64-character value is not later confused with another algorithm or an undocumented checksum.
Make Both Sides Hash the Same Bytes
A SHA-256 result identifies an exact byte sequence. The browser's Text mode first encodes the entered string as UTF-8, so the displayed byte count is part of the result context; it does not hash abstract characters. Accented letters, emoji, and scripts outside ASCII can occupy multiple bytes.
- Spaces matter. A leading or trailing space changes the bytes and therefore the digest.
- Line endings matter. A final newline, a carriage return, and a line-feed sequence are different bytes. Copying text through an editor or chat system can alter them.
- Unicode normalization matters. Two strings that look identical can use different normalization forms and hash differently.
- Text and file modes answer different questions. Text mode hashes the UTF-8 encoding of what you entered. File mode hashes the file's actual bytes without decoding them as text.
- Metadata is part of a file. File mode includes headers and embedded metadata as well as visible content.
- Command-line input can change silently. A shell command that appends a newline or reads a different path will produce a valid but different digest.
When a Terminal and browser result disagree, keep the algorithm and representation the same, then compare the input bytes and byte count rather than assuming the hash function failed. Check for a final newline, text encoding differences, Unicode normalization, or the difference between a saved file and pasted text.
Verify a Download Against an Authenticated Reference
For a software download, obtain the expected SHA-256 value from the publisher over HTTPS, through a signed release, or through another authenticated channel appropriate to the risk. Then run the Mac command or browser workflow on the exact downloaded file and compare all 64 Hex characters.
A matching digest is meaningful only when the expected value itself is authentic. If an attacker can replace both a file and the checksum displayed beside it, recalculating SHA-256 will confirm the attacker's pair. Local processing protects the selected content from being uploaded, but it does not establish the publisher's identity or authenticate a checksum fetched from an untrusted page.
Match the Hash to the Security Goal
A raw SHA-256 digest is a fixed one-way hash, not encryption. It has no key, supports no reverse operation, and does not authenticate who created an input. Choose the mechanism that matches the task:
| Goal | Suitable mechanism | What it provides |
|---|---|---|
| Byte-for-byte integrity | SHA-256 | Confirmation that two byte sequences match when the reference digest is authentic |
| Shared-secret message authentication | HMAC-SHA-256 | Message authentication when both systems share a secret |
| Public-key origin verification | Digital signature | Origin verification using the signer's public key |
| Password storage | Purpose-built password hashing | Password verification with unique salt and calibrated memory and time cost |
Do not store passwords by applying SHA-256 directly. Its speed is useful for integrity checks, but it also helps attackers test password guesses. Account systems should use a unique salt and a purpose-built password hashing function with calibrated memory and time cost.
Respect the Browser File Limit
The browser generator accepts files up to 100 MB. This cap exists because the Web Cryptography digest operation receives the complete byte buffer rather than streaming the file, so a much larger selection could exhaust browser memory. For larger artifacts, use a trusted streaming SHA-256 utility on the local machine instead.
Regardless of size, wait for the digest associated with the current selection, copy the complete value, and keep the original file unchanged while you compare it. A local hash is useful evidence of byte identity, but only an authentic reference makes that evidence meaningful.
If you're weighing options, SHA512 Hash Generator Alternative: Compare Options covers this in detail.
If you're weighing options, Generate SHA256 Hash of a File in Linux With sha256sum covers this in detail.