Hash & Security
SHA-1 Hash Generator
Generate a SHA-1 hash (digest) from text or a file online. Hex or Base64 output, uppercase option, instant results in your browser. Learn when SHA-1 is unsafe.
Leave this empty to hash the text box. Files stay in this browser.
Hex is compared without regard to case. A sha256= prefix, or a Stripe-style v1= value, is accepted. Base64 is compared exactly.
Paste text or choose a file, then generate the digest.
SHA-1 digest
—
Output actions
Ready to copy output once your result appears.
SHA-1 Hash Generator mini guide
SHA-1 compresses a message to 160 bits. Written out, that is 20 bytes, 40 hexadecimal characters, or 28 Base64 characters including the padding. This page accepts either a text box, read as UTF-8, or a file, read as the raw bytes on disk. Hex can be shown in lowercase or uppercase. Paste a digest you were given and the comparison line says match or no match. The work is done by the SHA-1 operation in Web Crypto. Nothing is uploaded.
How to use
- 1Type into the text box, or choose a file. A selected file replaces the text box for that run, because a checksum of a download is a checksum of the file bytes, not of a filename you typed.
- 2Pick hex or Base64. Hex has a lowercase and an UPPERCASE switch. Base64 keeps the standard alphabet, so that switch does not alter it.
- 3If you already have a published digest, paste it into Expected hash and select Generate hash. Match means both sides are the same 160-bit value. No match means they differ, often because of a trailing newline.
What it is good for
- • Checking an old release that still publishes a 40-character checksum.
- • Reproducing the FIPS sample for abc before you trust another implementation.
- • Seeing whether a hex string and a Base64 string are the same 20 bytes.
Example
Input
abc
Output
a9993e364706816aba3e25717850c26c9cd0d89d
FIPS 180-1. The same digest in uppercase is A9993E364706816ABA3E25717850C26C9CD0D89D, and in Base64 it is qZk+NkcGgWq6PiVxeFDCbJzQ2J0=.
What SHA-1 is
SHA-1 is the Secure Hash Algorithm published by NIST in FIPS 180-1 in 1995. It belongs to the earlier generation that sits between MD5 and the SHA-2 family. The function walks the message in blocks of 512 bits, which is 64 bytes. Each block is expanded into eighty 32-bit words, and the compression function mixes those words into five 32-bit state words. The initial state is a fixed constant. When the message ends, the function appends a single 1 bit, zeros, and a 64-bit length, the same Merkle–Damgård padding pattern used by MD5. The final five words are the digest. Five times 32 is 160 bits, so the hex form is always 40 characters and never grows with the input. A novel and a one-line string produce digests of equal length. That fixed width is why people use the length of a mystery string as a hint, and why a 40-character string is not proof by itself: RIPEMD-160 is also 160 bits.
The design goal was a one-way fingerprint. Given the digest, you should not be able to recover the message, and you should not be able to find two messages that share a digest. The second property is collision resistance, and it is the one that failed. In 2005 cryptanalysts showed theoretical collisions cheaper than brute force. In 2017 the SHAttered work produced a practical collision: two different PDF files with the same SHA-1. Later chosen-prefix attacks made the collision useful against real formats, not only against files the attacker builds from scratch. A preimage attack, recovering an unknown input from the digest alone, is still not practical. That distinction matters. SHA-1 is broken as a signature hash and as a certificate hash, because an attacker can craft two documents that verify under the same signature. It is not a practical way to invert a random digest. Treating it as 'just a checksum' is safe only when nobody benefits from forging a second file that matches.
Git used SHA-1 for object names for many years. The object id is a SHA-1 of the object header plus the content, so a collision in the hash is a collision in the object store. Current Git versions detect the known collision class and refuse to store the colliding objects. That is a defense inside Git, not a reason to pick SHA-1 for a new protocol. TLS certificates stopped using SHA-1 signatures years ago. Browsers still expose SHA-1 in Web Crypto because HMAC-SHA1, some legacy signatures, and old file formats still need it. This page uses that browser primitive. It does not invent a JavaScript SHA-1, and it does not send the message to a server to be hashed there.
A 40-character hex string is the width this page produces, but RIPEMD-160 has the same width, so length is only a first guess. The hash identifier lists both. A 32-character checksum is an MD5 checksum. A 64-character checksum is a SHA-256 digest. A 128-character checksum is a SHA-512 digest. A value that depends on a shared secret is an HMAC, not a bare SHA-1 of the body.
Test vector for abc
The string abc, three bytes, with no newline, is the first sample in the SHA-1 specification. Its digest is a9993e364706816aba3e25717850c26c9cd0d89d. Paste abc into the text box, leave the file input empty, choose lowercase hex, and generate. The output should be those 40 characters. The comparison field accepts the same string in uppercase, and it accepts spaces inserted for readability. It does not accept a different encoding of the letters. If you choose Base64, the output is qZk+NkcGgWq6PiVxeFDCbJzQ2J0=, and the expected field must use that alphabet or it will report no match even though the underlying 20 bytes are right.
The empty message is also defined. Hashing a blank text box, with no file selected, produces da39a3ee5e6b4b0d3255bfef95601890afd80709. That is useful when a script and this page disagree and you want a second sample that is not abc. A third sample from the same standard is the 56-byte string abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq, whose digest is 84983e441c3bd26ebaae4aa1f95129e5e54670f1. Fifty-six bytes is long enough that the padding does not fit in the first 64-byte block, so this sample exercises a second block. If a library matches abc and fails this one, the bug is usually in the length padding.
A newline is part of the message. The shell command echo abc | sha1sum hashes a b c and a line feed, four bytes, and the digest changes. printf '%s' abc does not add that line feed. Editors that save a trailing newline, and copy operations that include one, cause the same mismatch. When the page says no match, check the byte length before you blame the algorithm. Hashing the file and hashing a paste of the file are the same only when the paste contains every byte, including a final newline the editor may have hidden.
printf '%s' abc | sha1sum printf '%s' abc | shasum -a 1 printf '%s' abc | openssl dgst -sha1
Command-line equivalents
On Linux, sha1sum reads a file and prints the lowercase hex digest, a space, a marker, and the filename. The digest is the first field. On macOS the same program is often shasum -a 1. OpenSSL prints SHA1(filename)= followed by the hex, or, when reading standard input, the hex alone with a label. Certutil on Windows uses certutil -hashfile path SHA1 and prints the hex with spaces between bytes. This page omits the filename and the spaces. Paste only the hex into Expected hash, or paste the spaced form: the comparison ignores whitespace.
Hash the file you downloaded, not a re-saved copy that a text editor may have rewritten. A zip file opened and saved again is a different byte string. The file control on this page reads the bytes the browser received. That matches sha1sum of the same download. It does not match a checksum of the unzipped contents unless the publisher hashed the contents. Read the release note to see which path they hashed.
Security notes
Do not use SHA-1 for passwords, API tokens, certificate signatures, or document signatures. A password hash must be slow and salted. SHA-1 is fast, and a fast hash is what a password cracker wants. Use bcrypt, scrypt, or Argon2 for passwords. A signature should use SHA-256 or stronger inside the signature scheme. A file checksum can still be SHA-1 when you are confirming a download against a value the publisher sent through a channel the attacker does not control, and when you accept that a determined attacker can build a second file with the same digest. If the checksum is hosted on the same server as the file, replacing both is trivial and the checksum proves nothing about the publisher. Prefer a signature, or at least a SHA-256 checksum delivered separately.
HMAC-SHA1 is a different object. The HMAC construction authenticates a message under a secret key. Collision attacks against bare SHA-1 do not automatically break HMAC-SHA1, and some old protocols still specify it. New designs should use HMAC-SHA256. This page does not compute HMAC. The HMAC generator does, and it can show the GitHub and Stripe header formats. Do not paste a password into this SHA-1 tool to 'store a hash of it'. The output is not a password hash, and the password would still be sitting in the page.
Rules and limitations
Text is UTF-8. A file is raw bytes, up to 32 MB, and it overrides the text box until you clear it. The empty text box is a real message: it hashes to the empty-string digest above, rather than an error. Hex comparison ignores case, spaces, and a leading sha1= prefix. Base64 comparison does not ignore case, because the alphabet uses both.
The letter-case control changes only hex. Choosing UPPERCASE and then Base64 leaves the Base64 alphabet as it is. The page does not follow symlinks, does not hash a directory, and does not include the filename in the input. Two files with the same bytes and different names produce one digest.
Common problems
No match after a file checksum usually means a newline, a UTF-8 byte-order mark, or a checksum of the archive versus a checksum of the unpacked files. Compare the size in bytes with the size the publisher listed. Windows and Unix line endings are different messages.
A 40-character string that still does not match may be RIPEMD-160, or SHA-1 of a different prefix such as a Git header. Git object ids are not the SHA-1 of the file bytes alone. This page hashes exactly the bytes you give it.
Frequently asked questions
Is SHA-1 broken?
It is broken for collisions. Attackers have built distinct files with the same SHA-1, including a chosen-prefix attack that is strong enough to matter for signatures. Finding an unknown input from a digest alone is still not practical. Do not use SHA-1 for certificates, document signatures, or any place where someone else can choose the bytes. A non-adversarial checksum of a file you already trust is a weaker claim, and SHA-256 is still the better default.
Why does sha1sum disagree with this page?
echo adds a newline. Hash abc with printf '%s' abc | sha1sum and the digest is a9993e364706816aba3e25717850c26c9cd0d89d, the same value this page shows for the text abc. Hashing a file with sha1sum matches this page when you select that same file. A paste into the text box matches only when every byte, including a final newline, was pasted.
Can I hash a file without uploading it?
Yes. The file input reads the bytes with the browser file API and passes them to Web Crypto on this machine. The page does not have a server-side hash step. There is a 32 MB limit so a huge file does not lock the tab. For larger files, use sha1sum or shasum locally.
Should I store passwords as SHA-1?
No. SHA-1 is fast, and password hashes must be slow. Use Argon2, bcrypt, or scrypt, with a unique salt stored beside the hash. A SHA-1 of a password, even with a salt, is the wrong tool. Do not paste live passwords into this page to experiment. Use a throwaway string if you only want to see the digest format.
Is my input uploaded or saved?
This tool processes input in your browser and does not save its input or output to local storage. Copy and download are user actions. The site uses analytics for page and action metadata and may use ads and production error reporting; see the Privacy Policy for those services.
About this tool
Maintained by Toolbench. For large or deeply nested files, split the input into smaller batches and verify representative results before using them in an import or application. Report reproducible problems through Contact.
Next steps
Related tools
Continue the workflow with nearby tools for formatting, publishing, debugging, or follow-up checks.
SHA-512 Hash Generator
Create a SHA-512 digest from text or a file and compare an expected value.
Open SHA-512 Hash GeneratorMD5 Hash Generator
Generate an MD5 checksum from text or a file and compare it with an expected digest.
Open MD5 Hash GeneratorHMAC Generator
Sign a message with HMAC-SHA256, HMAC-SHA1, or HMAC-SHA512 and compare a webhook signature.
Open HMAC GeneratorHash Identifier
Guess a hash family from digest length and alphabet.
Open Hash IdentifierTrust
Policies, contact, and answers
Clear pages for how Toolbench works, what we collect, and how to reach us.