To get the SHA-1 hash of a file on Windows, use PowerShell’s Get-FileHash command or a local browser tool; SHA-1 produces a 160-bit digest, normally written as 40 hexadecimal characters.

Both routes can support a legacy checksum check. PowerShell suits terminal and script workflows. The browser route is useful when you want to hash a selected file without opening a command prompt or need the digest in either Hex or Base64. In either case, hash the exact artifact you received and compare the result with a reference obtained through a trusted channel.

get sha1 hash of file windows
Get SHA-1 Hash of a File in Windows: Two Methods

Choose between PowerShell and a browser

The two methods use the same SHA-1 algorithm but offer different interfaces and output choices. Select the method that fits your Windows environment and the format required by the system publishing the checksum.

Method What it reads Output Processing and fit
PowerShell Get-FileHash A local file identified by its path SHA-1 in hexadecimal Runs through the local Windows shell and fits terminal or administrative workflows.
Sha1 Hash Generator Exact local file bytes or UTF-8 text 40 lowercase Hex characters or 28 padded Base64 characters Processes the selection in the browser tab without sending the file to the application server; file selections are limited to 100 MB.

Use the Sha1 Hash Generator when you need a browser-only workflow or a Base64 reference. Its file mode hashes the bytes exactly as read, excluding the filename, modification time, and browser MIME label. For Windows administration scripts or command-based automation, the native PowerShell command is more direct.

Get the hash with Windows PowerShell

PowerShell’s Get-FileHash cmdlet calculates a SHA-1 digest for a local file without requiring a third-party hashing program.

  1. Open PowerShell in Windows.
  2. Locate the file and use its full path. A full path such as C:\Downloads\example.zip avoids ambiguity about the current working directory.
  3. Run Get-FileHash -Path "C:\Downloads\example.zip" -Algorithm SHA1, replacing the example path with your own.
  4. Copy the 40-character hexadecimal value from the Hash field. To print only the digest, run Get-FileHash -Path "C:\Downloads\example.zip" -Algorithm SHA1 | Select-Object -ExpandProperty Hash.
  5. Compare every hexadecimal character with the expected SHA-1 checksum from a trusted source. Confirm that the published value is Hex rather than Base64.

Get-FileHash hashes the file content rather than its name. Its standard result is hexadecimal, while the browser generator can also encode the same 20 digest bytes as padded Base64. Those are two representations of one digest, but their strings differ and cannot be compared directly as though one were the other.

Hash a file locally in your browser

The browser workflow avoids entering a filesystem path and gives you a direct choice of output representation.

  1. Open the Sha1 Hash Generator in your browser.
  2. Choose file bytes and select the local file you want to hash. Use file mode for a downloaded archive, installer, image, or other binary artifact; do not substitute text mode for a binary file.
  3. Click the button to generate the digest. The selected file is read and hashed in the browser tab and is not sent to the application server.
  4. Select lowercase Hex when the legacy system expects a hexadecimal checksum. Select standard padded Base64 when that is the published representation.
  5. Copy the result without shortening it. A SHA-1 Hex digest is exactly 40 characters, while its padded Base64 encoding is exactly 28 characters.
  6. Compare every character with the reference checksum obtained through a trusted channel.

Hex and Base64 do not represent different hash results in this workflow. The tool calculates one 20-byte SHA-1 digest and then encodes those same bytes in the selected format.

Understand what becomes the hashed input

The most common cause of an unexpected result is choosing an input mode that does not match the way the reference checksum was created.

Input mode Exact data hashed Details that affect the result
Text The visible string encoded as UTF-8 Spaces, line endings, and a final newline participate. Accented letters, emoji, and non-Latin scripts can occupy several UTF-8 bytes.
File The raw bytes exactly as read The filename, modification time, and browser MIME label are excluded from the digest.

File mode is normally the correct choice for a downloaded artifact. Text mode is appropriate only when the publisher explicitly hashed a text string as UTF-8. Two visible strings can produce different digests if their byte encodings, line endings, or final-newline states differ.

Do not normalize whitespace, remove a trailing newline, convert line endings, or change the text encoding before trying to reproduce a checksum. Those operations change the input bytes. Likewise, hashing an extracted file will not reproduce a checksum previously calculated for the original archive.

Compare the checksum without making a false match

A checksum comparison is meaningful only when the algorithm, artifact, and representation all match.

  • Confirm that the reference value is labeled SHA-1 rather than MD5, SHA-256, or another algorithm.
  • Confirm that you hashed the same artifact, such as the downloaded archive rather than one file extracted from it.
  • Match the required representation: lowercase Hex from the browser tool or standard padded Base64. Hex letter case does not change the digest, but Base64 is case-sensitive.
  • Check all 40 Hex digits or all 28 Base64 characters. Do not silently trim, re-encode, or replace characters in the result.

If the values differ, check the input mode and output format before suspecting the algorithm. Also confirm that the file was not edited, converted, extracted, or repackaged after the reference checksum was produced. A SHA-1 match can detect accidental transfer damage in this limited legacy workflow, but it does not prove authorship or protect against deliberately crafted collisions.

Use SHA-1 only for legacy compatibility

SHA-1 is defined by NIST FIPS 180-4. The algorithm pads the input, processes it in 512-bit blocks, and produces a final 160-bit state. Its security properties are no longer suitable for modern collision-sensitive designs, as discussed in RFC 6194.

SHA-1 is collision-broken: attackers can construct different content with the same digest under realistic conditions. Do not use a SHA-1 match as proof of identity or use SHA-1 for:

  • Digital signatures or certificate decisions
  • Password storage
  • Adversarial file approval or tamper protection
  • New security protocols or designs

Use SHA-256 or SHA-512 when the protocol permits a stronger algorithm. A plain hash is also not a password hash: account systems should use a salted, deliberately expensive scheme such as Argon2id, scrypt, or bcrypt. If you control the consuming system, migrate its stored reference to SHA-256 or stronger and publish the replacement checksum over an authenticated channel.

Understand the browser size limit

The browser utility accepts selected files up to 100 MB because the complete input must be available as one byte buffer before the digest operation completes. It is not a streaming replacement for multi-gigabyte images, archives, or other large artifacts.

  • For a file above 100 MB, use a trusted local operating-system hashing tool and confirm that it is configured for SHA-1 and the intended byte sequence.
  • Keep the original downloaded artifact when its exact bytes are covered by the published checksum.
  • For text references, confirm whether the publisher included a final newline and which line-ending convention was used.
  • For comparison problems, verify that both sides use the same format: Hex or Base64.

Once the exact legacy checksum matches, record which artifact and representation you verified. That provides a useful integrity check for accidental transfer damage without treating SHA-1 as a modern security guarantee.

For a deeper look, see Generate SHA256 Hash in Linux: Files and Text.

For a deeper look, see SHA512 Hash Generator: A Byte-Level Guide.