All tools

Hash generator

Create SHA hashes from text using Web Crypto.

Hash generator
Algorithm
InputTEXT

Press Command or Control plus Enter to run. Tab inserts indentation; press Escape, then Tab, to leave the editor.

Result
Your result will appear here.
Ready1 line · 11 chars

About the Hash generator

A hash function turns any amount of text into a short, fixed-length fingerprint called a digest. The same input always produces the same hash, but even a one-character change produces a completely different one. Hashes are used for checksums, cache keys, file integrity checks and signing.

This tool creates SHA-1, SHA-256, SHA-384 and SHA-512 hashes of your text using the Web Crypto API built into your browser, and shows the result in hexadecimal.

How to use the Hash generator

  1. Choose an algorithm in the Algorithm menu. SHA-256 is the best default.
  2. Type or paste your text into the Input editor.
  3. Click Generate hash or press Ctrl + Enter (Cmd + Enter on Mac).
  4. Click Copy result to copy the hex digest.

Examples

SHA-256 of a string

Input

hello world

Output

b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9

The same input always gives the same 64 hex characters, and any change gives a completely different hash.

SHA-1, for checking an older checksum

Input

hello world

Output

2aae6c35c94fcfb415dbe95f408b9ce91ee846ed

Common errors and how to fix them

My hash doesn't match the one from the command line

echo adds a newline, so echo hello | sha256sum hashes hello\n. Use printf 'hello' | sha256sum or echo -n to hash the same bytes.

crypto.subtle is undefined

The Web Crypto API only works in secure contexts. Serve your page over HTTPS or from localhost.

Can I use SHA-256 to store passwords?

No. Plain SHA is too fast to resist brute force. Use a password hashing function such as Argon2id, scrypt or bcrypt.

Good to know

  • Text is hashed as UTF-8. Every character counts, including spaces and line breaks, so a trailing newline changes the hash.
  • SHA-1 is no longer considered secure against collisions. Use it only to match older systems.
  • Don't use a plain SHA hash to store passwords. Use a dedicated password hashing function such as Argon2, bcrypt or scrypt.

Frequently asked questions

Can a hash be reversed to get the original text?

No. Hash functions are one-way. Short or common inputs can still be guessed by trying many candidates, which is why passwords need special slow hashing.

Why doesn't my hash match the one from another tool?

Usually because the input differs slightly, most often an extra space or line break, or a different text encoding. Check the exact text you are hashing.

Which SHA algorithm should I use?

SHA-256 suits almost every purpose. SHA-512 and SHA-384 give longer digests; SHA-1 is only for compatibility with older systems.