How to use the hash generator
Type or paste text and the hash updates as you type. The text is encoded as UTF-8 before hashing, which is what almost every programming language and command-line tool does. Pick a different algorithm from the Algorithm list at any time.
To hash a file, use Or hash a file. The file is read on your device with the FileReader API and hashed with crypto.subtle.digest; it is never uploaded. Typing in the text box switches back to hashing text.
The result is shown in two encodings of the same bytes. Hex (64 characters for SHA-256) is the usual format for checksums. Base64 (44 characters) is shorter and is used, for example, in Subresource Integrity attributes. The uppercase option only changes how hex is displayed; hex digests are not case-sensitive.
Worked examples
| Input | SHA-256 (hex) |
|---|---|
abc | ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad |
| (empty) | e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 |
hello | 2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824 |
hello + newline | 5891b5b522d5df086d0ff0b110fbd9d21bb4fc7163af34d08286a2e846f6be03 |
The last two rows show the most common surprise: echo "hello" | sha256sum hashes six bytes, because echo adds a line break. Use printf '%s' "hello" or echo -n to match this tool. To check a downloaded file, compare the hex value here with the output of sha256sum file on Linux, shasum -a 256 file on macOS or Get-FileHash file in PowerShell.
Which algorithm should you use?
- SHA-256 is the sensible default for checksums, content addressing and signatures.
- SHA-384 and SHA-512 come from the same SHA-2 family with longer output. SHA-384 is common in Subresource Integrity (
integrity="sha384-...", the Base64 output). - SHA-1 is broken for collision resistance: in 2017 researchers published two different PDF files with the same SHA-1. Use it only to match legacy systems, such as old Git object IDs.
Why MD5 is not offered
MD5 is not part of the browser's Web Crypto API, and that is deliberate: MD5 collisions can be produced in seconds on an ordinary laptop, so it no longer proves that a file is unmodified. Rather than ship a separate MD5 implementation that might suggest otherwise, this tool sticks to the algorithms the browser itself supports. If you must verify an old MD5 checksum, use md5sum or Get-FileHash -Algorithm MD5 locally, and prefer a SHA-256 checksum whenever one is published.
Common mistakes
- Hidden characters. A trailing newline, a Windows line ending (
\r\n) or a space copied along with the text changes the hash completely. - Different text encodings.
Grüßein UTF-8 and in Latin-1 are different bytes and therefore different hashes. .NET'sEncoding.Unicodeis UTF-16, not UTF-8. - Comparing hex with Base64. They are different spellings of the same digest; compare like with like.
- Storing passwords as plain SHA-256. Fast hashes are easy to brute-force. Use a password hashing function such as Argon2, bcrypt, scrypt or PBKDF2 with a salt.
Frequently asked questions
Can a SHA-256 hash be decrypted or reversed?
No. A hash is a one-way function, not encryption, so there is nothing to decrypt. Short or common inputs can still be found by guessing many candidates and comparing hashes, which is why hashes of simple passwords are not secret.
Why does my hash differ from the one sha256sum shows?
Usually because the input bytes differ. echo adds a trailing newline, files may use Windows line endings, and some tools hash text as UTF-16 instead of UTF-8. Hash exactly the same bytes and the results will match.
Why is MD5 not available?
MD5 is cryptographically broken: collisions can be created in seconds, so it cannot prove a file is unmodified. Browsers do not include it in the Web Crypto API, and this tool does not add its own implementation.
Are my files uploaded to a server?
No. Files are read locally with the FileReader API and hashed by your browser's Web Crypto API. Neither the file nor the hash leaves your device.
Is SHA-256 suitable for storing passwords?
Not on its own. SHA-256 is designed to be fast, which makes guessing attacks cheap. Store passwords with a slow, salted password hashing function such as Argon2, bcrypt, scrypt or PBKDF2.
How long is a SHA-256 hash?
256 bits, which is 32 bytes. That is 64 characters in hexadecimal or 44 characters in Base64, including one padding character.