Last updated:

How to Hash a File: SHA-256 on Windows and Mac, Step by Step

To hash a file on Windows, open Command Prompt and run certutil -hashfile "C:\path\to\file.pdf" SHA256; on a Mac, open Terminal and run shasum -a 256 /path/to/file.pdf. Either way you get a 64-character SHA-256 value, a fingerprint of that exact file. This guide gives the steps for both, then shows how to hash a whole exhibit folder, keep a hash log, check a file against a recorded value and, if you want a dated record, add a TimeBind.

Table of Contents

What a hash value is, in practice

A hash value (also called a checksum, digest or fingerprint) is a short value calculated from the contents of a file. Microsoft's documentation for its Get-FileHash command puts it this way: a hash assigns a value to the contents of a file rather than to its name or extension, so you can rename a file without changing its hash, while changing even a single character in the contents changes the hash. Two files with the same SHA-256 hash can be treated as having the same contents for practical purposes.

That gives you two uses in a practice. You can check that a copy is identical to an original, and you can record what a file looked like at a point in time so that a later version can be compared with it. Neither use depends on opening the file or reading it.

When to hash a document or exhibit

The useful moments are the ones where a file changes hands or form:

  • On arrival. A client sends a drive, a download link or a batch of attachments. Hash each file before anyone opens or re-saves it.
  • After you copy. Copy the original into the matter's originals folder, then hash the copy and compare it with the hash of the source.
  • When you finalise. Hash the final exhibit bundle, the executed agreement or the version you are about to send.
  • When you hand over. Send the hash list with files going to an expert, a vendor or the other side, and ask the recipient to check it on receipt.
  • After a restore. Hash restored originals and compare them with your log.

NIST's guide to forensic techniques (SP 800-86) describes the same sequence for imaging: compute the hash of the original, copy it, compute the hash of the copy and compare, then hash the original again to confirm the process did not alter it, documenting all results. NIST IR 8387 adds that hashing should happen as close to collection as possible.

US practitioners will recognise Federal Rule of Evidence 902(14), which refers to authenticating copied data by "a process of digital identification" with a qualified person's certification. The Sedona Conference commentary on it observes that hash-based verification compares the original's hash with the copy's, and that the time to think about it is collection. This page is about the practical step, not about that certification.

How to hash a file on Windows (Command Prompt and PowerShell)

Option 1: Command Prompt with certutil

  1. Press the Windows key, type cmd and press Enter.
  2. Type the command below, replacing the path with your file's path. Keep the quotation marks if the path has spaces.
certutil -hashfile "C:\Matters\Smith\Originals\engagement-letter-draft-1.txt" SHA256

The output shows a line naming the file, then the hash on its own line, then a line saying the command completed successfully. The hash line is the file's 64-character SHA-256 value.

Microsoft's documentation lists SHA256 among the algorithms certutil supports, alongside SHA1, MD5, SHA384 and SHA512. Microsoft also cautions that certutil is an administrator's tool and is not recommended for use in production code, so use it for hands-on checks like this one and use PowerShell if you plan to script anything.

Option 2: PowerShell with Get-FileHash

  1. Press the Windows key, type powershell and press Enter.
  2. Run:
Get-FileHash "C:\Matters\Smith\Originals\engagement-letter-draft-1.txt"

Get-FileHash uses SHA256 by default, and shows the algorithm, the hash and the path. To be explicit, add -Algorithm SHA256. Microsoft's documentation also shows a one-line way to check a file against a published value: (Get-FileHash "file.pdf").Hash -eq "PASTE-THE-RECORDED-HASH-HERE" returns True when they match.

How to hash a file on a Mac (Terminal)

  1. Open Terminal (press Command and Space, type Terminal, press Enter).
  2. Type shasum -a 256 (with a space after 256), then drag the file from Finder into the Terminal window. That fills in the path for you.
  3. Press Enter.
shasum -a 256 ~/Matters/Smith/Originals/engagement-letter-draft-1.txt

The output is the hash, then two spaces and the file path. The -a 256 matters: without it, shasum uses SHA-1 by default, which is an older algorithm. On Linux the equivalent command is sha256sum.

The same file gives the same hash on any system, because the hash depends only on the bytes. If the file is saved differently on another machine (for example with different line endings), its hash will be different, since those are different bytes.

How to check a file against a recorded hash

Run the same command on the file in front of you and compare the result with the value you recorded. Compare the whole 64 characters. Hex digits can be upper or lower case, so A1B2 and a1b2 are the same value. If every character matches, the file is identical to the one you recorded. If anything differs, the files are not identical.

A failed match is a prompt to investigate, not a conclusion. NIST IR 8387 points out that secure hashes are very sensitive, that files can change in ways that do not change the evidence itself, and that its primary approach is to save more than one copy so a corrupted file can be replaced with its backup. Re-hash the backup copy, check where the file has been, and look at the handling log.

How to hash a whole folder or exhibit bundle

For a bundle, create a manifest: a list of every file with its hash. Save the manifest outside the folder you are hashing, so it does not include itself.

Windows (PowerShell)

Get-ChildItem -Path "C:\Matters\Smith\Exhibits" -Recurse -File | Get-FileHash -Algorithm SHA256 | Export-Csv -Path "C:\Matters\Smith\exhibit-hashes.csv" -NoTypeInformation

Open the CSV in Excel to see each file's path and hash.

Mac (Terminal)

cd ~/Matters/Smith
find Exhibits -type f ! -name .DS_Store -exec shasum -a 256 {} + > exhibit-hashes.txt

To check the folder later, run shasum -a 256 -c exhibit-hashes.txt from the same folder. It lists each file as OK or FAILED, and warns you how many did not match. We tested these two commands on a small sample folder to confirm the behaviour, including a FAILED line after a file was edited.

Once you have a manifest, treat it as a document in its own right: file it with the matter, keep a copy somewhere separate, and, if you want it dated, run it through a TimeBind. One TimeBind covers up to 10 files, so a manifest is also a way to record a bundle of hundreds of exhibits with a single TimeBind: the TimeBind records the manifest file, and each exhibit can be checked against its hash in the manifest.

What to put in a hash log

A hash value on its own is not much use six months later. Record enough context to make it meaningful:

FieldExample
Matter and item2026-1043, Exhibit A-1
File name as receivedengagement-letter-draft-1.txt
SourceEmail from client, 4 Dec 2026, 10:12
SHA-256The full 64-character value
Hashed by, when, and with whatA. Lee, 4 Dec 2026 10:20, certutil on Windows 11
Where the original is storedMatters/2026-1043/Originals
TimeBind ID (if used)Added once the TimeBind is created

NIST IR 8387 recommends storing hashes in a secure location where they cannot be changed or overwritten. Practically, that means the log lives in your practice management system or a locked-down library, not in the folder it describes.

Why two copies of the same document can have different hashes

  • Re-saving. Opening a Word file or PDF, making a change and saving produces a different file. Even a "Save as" with no visible edits can change the bytes inside.
  • Converting or printing. A PDF printed from a Word file is a different file from the Word file, and a scan is a different file again.
  • Different line endings or encodings in text files. The same words can be stored as different bytes.
  • Transfer errors. A copy interrupted or corrupted in transit differs from the source. This is why you hash source and copy after copying.
  • Other systems rewriting files. Some portals, sync tools or viewers re-save or convert files, so check a sample through your own workflow before relying on it.

None of these is unusual. It is the reason the habit is to hash the original on arrival and compare copies against that value, rather than hashing whatever version happens to be on someone's desktop.

Which hash algorithm to use

Use SHA-256 for new work. MD5 and SHA-1 still appear in older tools and logs. Microsoft's documentation says they are no longer considered secure and recommends them only for simple change validation. NIST IR 8387 says it is acceptable to use an older algorithm if needed but that newer ones are preferred, and points to FIPS 180-4, the Secure Hash Standard, for approved algorithms. If someone sends you an MD5 or SHA-1 value, you can record it as received, and add a SHA-256 value alongside it.

How to date a hashed file with TimeBinder

A hash tells you whether two files are identical. It does not give you a date you did not control. If you want a dated record of the file as well, you can make a TimeBind. These are the steps in the TimeBinder web app:

  1. Go to app.timebinder.io and sign in or create an account.
  2. Add your file or files to a new TimeBind (up to 10 files per TimeBind). The fingerprints are calculated in your browser, and your files stay on your device.
  3. Optionally add a reference, such as the matter number and a short description.
  4. Choose a priority. A Pooled TimeBind is batched with others, and an ASAP TimeBind is sent as its own Bitcoin transaction.
  5. Pay by card or with Tokens (your first Pooled TimeBind is free).
  6. When it has confirmed, download the certificate PDF and file it with the matter next to your hash log.
  7. To check a file later, open the verifier in the app (or use the QR code or verifier link on the certificate), drop in the file and see whether it shows Verified or Verification Failed. A copy that is not identical will not match.

You can also calculate a hash in your browser with TimeBinder's SHA-256 file hash checker, which runs on your device and does not upload the file.

Sources and further reading

This page is general information about technology and process for practices, as at 4 December 2026. It is not legal, financial or security advice, and rules on electronic evidence differ by jurisdiction. Sources:

Where TimeBinder fits

Hashing tells you whether files are identical, and a TimeBind adds a date you did not control. A TimeBind records that your exact file existed no later than the recorded time, using SHA-256 fingerprints anchored in Bitcoin's blockchain. A typical use is the manifest of an exhibit bundle or a client's files on the day they arrive. It doesn't show who created a file or that its contents are true, and it doesn't guarantee that a court or counterparty will accept a record. It relies on SHA-256 and Bitcoin staying secure, which experts currently expect, but no one can guarantee future cryptography. Your files stay on your device; only their fingerprint is sent.

Date your first hashed file. Your first Pooled TimeBind is free, then from US$5. Make a TimeBind →

Frequently Asked Questions

  1. How do I get the SHA-256 hash of a file on Windows?

    Open Command Prompt and run certutil -hashfile "C:\path\file.pdf" SHA256, or open PowerShell and run Get-FileHash "C:\path\file.pdf", which uses SHA-256 by default.

  2. How do I get the SHA-256 hash of a file on a Mac?

    Open Terminal and run shasum -a 256 followed by the file path, or drag the file into the Terminal window after typing the command.

  3. Does hashing a file change it?

    No. Calculating a hash reads the file and leaves it as it is. Take care that opening a file in an application and saving it is a different step and can produce a different file.

  4. Can I hash a whole folder?

    Yes. Create a manifest of every file's hash with the PowerShell or Terminal commands above, store it outside the folder, and check it later with the same tools.

  5. Is it safe to use an online hash checker with client files?

    Check how the tool works before using it. TimeBinder's checker calculates the hash in your browser, on your device, and does not upload the file. Whichever tool you use, confirm its behaviour with your own IT policy first.

  6. What is a TimeBind, and how does it relate to a hash?

    A TimeBind records that your exact file existed no later than the recorded time. It uses the file's SHA-256 fingerprint, anchored in Bitcoin's blockchain. You can hash a file yourself first to keep your own log, then TimeBind it to add a date.

  7. How much does a TimeBind cost?

    Your first Pooled TimeBind is free, then from US$5.