SHA1 Hash Generator
HG-02Paste text to get its SHA-1 hash as 40 hex characters or as Base64. SHA-1 is fine for matching existing values, but it is not safe for signatures or passwords.
Runs in your browser. Nothing is uploaded.
Text (hashed as UTF-8)
SHA-1 hash
How to use it
- Type or paste your text into the input box. Sample loads the quick brown fox example.
- The SHA-1 appears as you type. Under Output, pick lowercase hex, uppercase hex or Base64.
- Tick Ignore one trailing line break if your text ends with a newline you did not mean to include.
- Copy the hash, or download it as a .txt file.
What this SHA-1 hash is
Your text is encoded as UTF-8 and hashed with SHA-1 by your browser's built-in Web Crypto. The result is 160 bits, shown as 40 hex characters or 28 characters of Base64. The text is hashed exactly as typed, so a trailing space or newline changes the hash. Empty input is valid and gives da39a3ee5e6b4b0d3255bfef95601890afd80709. Tick Ignore one trailing line break if the text came from a file that ends with a newline.
Is SHA-1 still safe to use?
Not against an attacker. Researchers have produced two different files with the same SHA-1 hash, which breaks its use for digital signatures and certificates, and browsers and certificate authorities stopped accepting it. It still appears in older protocols, checksums and APIs, and there you may need to produce a SHA-1 value on purpose. For new work choose SHA-256. Do not store passwords with it.
Choosing the output format
Lowercase hex is the most common form and what tools such as sha1sum print. Uppercase hex shows up in some Windows tools and older documentation. Base64 is shorter and is used where a hash goes into a header or a token, for example in the WebSocket handshake, where the server returns the Base64 of a SHA-1 of the client key joined to a fixed string. All three are the same 20 bytes written differently.
Questions people ask
How do I generate a SHA-1 hash online?
Type or paste your text into the input box and the SHA-1 appears straight away as 40 hex characters. Switch the output to uppercase hex or Base64 if you need another format, then copy it or download it as a .txt file. The hash is computed in your browser.
What is the SHA-1 hash of an empty string?
It is da39a3ee5e6b4b0d3255bfef95601890afd80709. Clear the input box and this tool shows it, because empty text is valid input. If a system gives a different value for empty input, it is not hashing the raw bytes with plain SHA-1.
Is SHA-1 deprecated?
For security uses, yes. Two different files with the same SHA-1 hash have been published, and standards bodies and browsers moved to SHA-256 and newer. SHA-1 remains in use for legacy checksums and some protocols that cannot change, where nobody is trying to forge a collision.
Why is my SHA-1 different from the one in my code?
The usual causes are a trailing newline, a different text encoding, or hashing more than the text. Git, for example, hashes a short header plus the content, so a Git object ID will not equal the SHA-1 of the file text. Make sure both sides hash exactly the same bytes.
How long is a SHA-1 hash?
A SHA-1 hash is 160 bits, or 20 bytes. In hex it is always 40 characters, and in Base64 it is 28 characters ending in one = sign. The length is the same for every input, whether it is one letter or a large document.
Can I use SHA-1 to store passwords?
No. SHA-1 is fast, so guesses can be tested at enormous speed, and it has known collision attacks. Use a slow, salted password hash such as bcrypt, scrypt or Argon2. This tool is for checking and matching values, not for password storage.
About this tool
SHA-1 is computed by your browser's built-in Web Crypto. It is no longer considered secure: researchers have produced two different files with the same SHA-1 hash. Do not use it to store passwords or to sign data. It is fine for matching an existing SHA-1 value, such as a legacy checksum. The text is hashed exactly as typed, as UTF-8, so a trailing line break or a space changes the result; "Ignore one trailing line break" removes one. It hashes text, not files: a file saved with different line endings would give a different hash than the same words typed here.