Saved

Press the star next to a tool's name to save it.

All my tools

SHA-1 Hash Generator

This SHA-1 hash generator makes the 160-bit SHA-1 hash of text or a file, in hex and Base64, and compares it with an expected checksum, all in your browser.

Every character counts, including spaces and line breaks. Files can be up to 1 GB.

Your text and files stay on this device. Nothing is uploaded.

SHA-1 hash

Working…

Enter some text or choose a file.

A SHA-1 hash generator turns any text or file into its SHA-1 digest, a 40-character fingerprint. Type or paste text, or choose a file, and this SHA-1 hash generator shows the hash in hexadecimal and Base64, its length and the size of the input. Paste an expected hash to check whether a download or a copy matches. Everything is worked out in your browser, so your text and files never leave your device.

What SHA-1 is

SHA-1, short for Secure Hash Algorithm 1, is a hash function that takes an input and produces a 160-bit (20-byte) hash value called a message digest, usually written as 40 hexadecimal digits. It was designed by the United States National Security Agency, published in 1995, and is a U.S. Federal Information Processing Standard. The same input always gives the same hash, and changing even one character gives a completely different one.

SHA-1 is no longer secure

SHA-1 has been cryptographically broken, although it's still widely used. It hasn't been considered secure against well-funded attackers since 2005, and in February 2017 researchers at CWI Amsterdam and Google published two different PDF files with the same SHA-1 hash, a collision. NIST deprecated SHA-1 in 2011, disallowed it for digital signatures in 2013 and has said it should be phased out by 2030. All major browsers stopped accepting SHA-1 certificates in 2017. For anything security-related, use SHA-256 or another SHA-2 or SHA-3 hash instead. SHA-1 is still considered secure for HMAC.

When SHA-1 is still useful

  • Checking a file against a published SHA-1 checksum to catch accidental corruption in a download.
  • Working with older systems and formats that still identify content by SHA-1.
  • Comparing copies of a file to see whether they're identical.
  • Learning how hash functions behave.

Because collisions can be made on purpose, a matching SHA-1 hash doesn't prove a file hasn't been tampered with by someone determined to do so.

How to use the SHA-1 hash generator

  1. Choose Text or File.
  2. Type or paste the text, or choose a file up to 1 GB.
  3. Optionally paste an expected hash to compare.
  4. Press Generate hash, then copy the result.

Example

The SHA-1 hash of the text hello is aaf4c61ddcc5e8a2dabede0f3b482cd9aea9434d. Change it to Hello, with a capital H, and the hash becomes f7ff9e8b7bb2e09b70935a5d785e0cc5d9d0abf0, completely different. Every character counts, including spaces and line breaks, so trailing spaces or a different line ending change the hash.

Comparing hashes

To check a download, paste the SHA-1 checksum published by the provider into the comparison box and generate the hash of your downloaded file. If the two match, the file is the same as the one the provider hashed. The comparison ignores capital letters and spaces, so you can paste the checksum in any format.

Is it private?

Yes. The hash is calculated by your browser's built-in cryptography. Your text and files are never uploaded.

SHA-1 compared with SHA-256

SHA-1 produces a 160-bit hash, 40 hex characters, while SHA-256 produces a 256-bit hash, 64 hex characters. SHA-256 is part of the SHA-2 family, which is the recommended replacement for SHA-1. If a system gives you a choice, use SHA-256. If you're checking a file against a published checksum, use whichever algorithm the publisher used: a SHA-1 checksum must be compared with a SHA-1 hash. Our SHA-256 hash generator works the same way for SHA-256.

Hex and Base64

The hash is shown in hexadecimal, the usual 40-character form made of the digits 0 to 9 and the letters a to f. The same 20 bytes are also shown in Base64, a shorter form used by some systems and APIs. Both represent exactly the same hash. Tick Show in capital letters if a system expects upper-case hex.

Text encoding

Text is converted to bytes using UTF-8 before it's hashed, which is what most systems use. If another tool gives a different hash for the same text, check for differences in invisible characters such as a trailing space or a line break, or whether the other tool uses a different text encoding.

Hashing large files

Files of up to 1 GB can be hashed. The whole file is read into your browser's memory first, so very large files may take a few seconds on a phone or an older computer. The page shows the input size once the hash is ready, so you can confirm the right file was read.

Why hashes look random

A good hash function spreads its output so evenly that the result looks random, even though it's completely determined by the input. That's what makes a hash useful as a fingerprint: two different inputs are extremely unlikely to share a hash by accident, and nothing about the hash reveals the original text.

Common mistakes

  • Using SHA-1 for security. Use SHA-256 instead.
  • Extra spaces or line breaks in text, which change the hash.
  • Comparing different algorithms. A SHA-1 hash never matches a SHA-256 hash.
  • Expecting to reverse it. A hash can't be turned back into the input.

What next

Use this often? Add SHA-1 Hash to your Home screen.

Frequently asked questions

How does the SHA-1 hash generator work?

Your browser runs the SHA-1 algorithm on your text or file and shows the 160-bit result as 40 hexadecimal characters and in Base64.

Is SHA-1 secure?

No. SHA-1 has been broken; practical collisions exist. Use SHA-256 or another SHA-2 or SHA-3 hash for security.

How long is a SHA-1 hash?

160 bits, written as 40 hexadecimal characters.

Can I hash a file?

Yes. Choose File and pick a file up to 1 GB; it's hashed on your device.

Can a SHA-1 hash be reversed?

No. Hash functions are one-way.

What went wrong?

We only receive the reason you pick, never what you typed into the tool.

Thanks for your feedback.

More Developer Tools