NathanTools

SHA-1 Hash Generator

Type or paste text, or drop a file, to get its 40-character SHA-1 hash. Everything is calculated in your browser.

100% free No sign-up Works on any device

Report a bug

SHA-1 Hash Generator

Text to hash

Hashes

SHA-1 —
MD5 —
SHA-256 —
SHA-384 —
SHA-512 —

Updated November 2026 · Calculated in your browser

How to generate a SHA-1 hash

  1. Type or paste text into the box, or switch to File and drop any file up to 512 MB.
  2. The SHA-1 hash (highlighted) and the four other common hashes appear as you type.
  3. Pick hex or Base64 output, and turn on HMAC if you need a keyed signature.
  4. Press Copy, or paste a published checksum into Compare to check a download.

SHA-1 at a glance

Digest size160 bits (40 hex characters)
Published1995 (FIPS 180-1)
Designed byNSA
SecurityBroken: the first public collision (SHAttered) was published in 2017
Common usesLegacy systems, older Git repositories, HMAC-SHA1 in old protocols

SHA-1 was designed by the NSA and published by NIST in 1995. Theoretical weaknesses appeared in 2005, and in 2017 Google and CWI Amsterdam published SHAttered: two different PDF files with the same SHA-1 hash. Browsers stopped trusting SHA-1 TLS certificates the same year, and Git is moving its object IDs to SHA-256. Use SHA-1 only when an existing system requires it.

SHA-1 examples

The SHA-1 of The quick brown fox jumps over the lazy dog is:

2fd4e1c67a2d28fced849ee1bb76e7391b93eb12

The SHA-1 of an empty input (zero bytes) is:

da39a3ee5e6b4b0d3255bfef95601890afd80709

If you ever see the second value, the program hashed nothing, usually because a file path was wrong or a variable was empty. Change a single character of the input and the whole hash changes, which is what makes hashes good at detecting modified files.

Why your SHA-1 hash doesn't match

A hash is calculated from bytes, not from what you see on screen. Two inputs that look identical can produce different hashes:

  • A trailing newline. echo "abc" | sha1sum hashes abc plus a line break. Use echo -n or printf.
  • Line endings. Windows saves text with CRLF, macOS and Linux with LF, so the same text file hashes differently.
  • Text encoding. This tool hashes text as UTF-8, the web standard. PowerShell strings and some Windows APIs use UTF-16.
  • Hex or Base64 input. If your input is already bytes written as hex or Base64 (for example a key), set Input is to match.
  • Letter case doesn't matter. 2FD4E1C6… and 2fd4e1c6… are the same hash.

Check a file's SHA-1 checksum on your computer

The File tab works for most files. To check very large files, or to script it, use the built-in command on your system:

SystemCommand
Windows (PowerShell)Get-FileHash file.zip -Algorithm SHA1
Windows (Command Prompt)certutil -hashfile file.zip SHA1
macOSshasum -a 1 file.zip
Linuxsha1sum file.zip
Any (OpenSSL)openssl dgst -sha1 file.zip
Text, macOS/Linuxprintf '%s' 'your text' | sha1sum

Generate SHA-1 in code

LanguageCode (UTF-8 text → hex)
Pythonhashlib.sha1("text".encode()).hexdigest()
Node.jscrypto.createHash("sha1").update("text").digest("hex")
PHPhash("sha1", "text")
C# (.NET 5+)Convert.ToHexString(SHA1.HashData(Encoding.UTF8.GetBytes("text")))
JavaMessageDigest.getInstance("SHA-1").digest(text.getBytes(UTF_8))

For an HMAC, use hmac.new(key, msg, hashlib.sha1) in Python or crypto.createHmac("sha1", key) in Node.js.

HMAC-SHA-1: hashing with a secret key

A plain hash lets you compare a file with an expected digest. Anyone who can replace the file can compute a new digest. An HMAC (hash-based message authentication code, RFC 2104) also mixes in a secret key, so only someone who holds the key can produce the right value. Webhooks from payment and messaging services, signed API requests and JSON Web Tokens (HS256) all work this way. Turn on HMAC with a secret key, enter the key, and compare the result with the signature you received.

MD5 vs SHA-1 vs SHA-256 vs SHA-384 vs SHA-512

AlgorithmOutputHex lengthCollision-resistant?Use it for
MD5128 bits32No (broken 2004)Non-security checksums
SHA-1160 bits40No (broken 2017)Legacy compatibility only
SHA-256256 bits64YesThe default for integrity and signatures
SHA-384384 bits96YesHigh-assurance and government systems
SHA-512512 bits128YesLarge files on 64-bit systems

Passwords are different. All five are built to be fast, which helps attackers guess billions of passwords a second. Store passwords with Argon2id, bcrypt or scrypt, and use our password generator to create them.

Compare a download to the digest for the exact release

Start on the publisher's release page or in a manifest you trust. Find the row for your exact file, including its version, platform and archive format. A Windows ZIP and a Linux archive from the same release can have completely different checksums. If the manifest lists several algorithms, select SHA-1 only when that is the one next to the expected value you copied.

Load the downloaded archive in File mode before extracting it. Paste the digest from the matching row, excluding the filename and any punctuation printed beside the value. Choose the matching output encoding so you can compare like with like. If a published SHA-256 digest is a string of 64 hexadecimal characters, for example, comparing it to Base64 text visually only compares two spellings of the data.

When a result differs, first recheck the filename and version. Download it again from the official location if the transfer may have been interrupted. Keep the expected digest separate while you repeat the check. If the second download still differs, check the publisher's release notes for a replacement or report the mismatch with the filename, expected digest and observed digest. Avoid running the file while you are still investigating.

Know what the result establishes

The comparison connects the downloaded bytes to the expected value you supplied. A trustworthy expected value matters just as much as a correct calculation. For example, someone who can replace a download and edit a checksum displayed next to it can make those two values agree. When the publisher offers a signed release or a signed manifest, follow the publisher's signature verification instructions as well.

For a simple transfer between colleagues, you might receive the checksum in an internal release ticket and the file through a separate download channel. Compare the value before unpacking the file. For an automated release process, record the hash algorithm and expected output format in the manifest. This prevents a later reader from having to guess whether the characters are hex, Base64 or a shortened display value.

If a text fixture produces a different result from a file with the same visible text, compare the underlying bytes. Save the fixture in the expected encoding and check whether the editor appended a final newline or a byte order mark. If your application hashes a JSON request, capture the serialized test body as it was sent. Reserializing the same fields can change spacing, ordering or escaping and therefore change the digest.

Leave enough room in verification records for the entire digest. A table or terminal can wrap a long value across lines, and a report may show only the first few characters. Copy from the full manifest or command output when you need to check a match. An abbreviated value can help you recognize the right row, but it carries less information than the full digest.

Check legacy records while planning a migration

When an internal record identifies a file using SHA-1, use the algorithm named in the old record to compare that file. Keep the legacy identifier if other records still reference it. For future verification, calculate a stronger digest from the available originals and add an algorithm label beside each new value. Store both values during a migration if you need to match old references. A Git object ID can also cover a header as well as the object's content, so a plain file digest and the ID reported by Git may differ even when the visible file is identical. NIST's SHA-1 transition notice.

Frequently asked questions

SHA-1 produces a 160-bit digest, written as 40 hexadecimal characters or 28 Base64 characters. The length is the same whether you hash one letter or a 4 GB file.

No. A hash is a one-way function, not encryption, so there is no key to decrypt it. "SHA-1 decrypt" sites only look up hashes of words and passwords they have already computed, which is why short or common inputs can be found.

Not for security. Broken: the first public collision (SHAttered) was published in 2017, so attackers can create two different inputs with the same hash. Use SHA-256 for anything security-related, and keep SHA-1 for non-security checksums.

The input bytes differ. The usual causes are a trailing newline (echo adds one; use echo -n or printf), Windows line endings (CRLF) instead of Unix (LF), a space at the end, or text encoded as UTF-16 instead of UTF-8. Hex case doesn't matter: ABC and abc are the same hash.

HMAC mixes a secret key into the hash, so only someone with the key can produce the same value. APIs such as payment webhooks use HMAC-SHA256 to sign requests. Turn on "HMAC with a secret key" above to calculate one.

No. General-purpose hashes like MD5 and SHA-2 are designed to be fast, which makes guessing passwords fast too. Store passwords with a slow, salted password hash such as Argon2id, bcrypt or scrypt.

No. Hashes are calculated in your browser with the Web Crypto API (and a built-in MD5 implementation), so your text, files and keys never leave your device.

Comments

No comments yet.

Share this tool

SHA-1 Hash Generator

Favorites

Drag to reorder, or use the arrows. Categories and the tools inside them can both be moved.

Saved in this browser. Sign in to keep them on every device.

Esc
↑ ↓ to moveEnter to open