Skip to content
WebTricks

Hash generator

Generate SHA-1, SHA-256, SHA-384 or SHA-512 hashes of any text using the browser Web Crypto API.

SHA-256 digest

What this hash generator does

Type or paste text and get its SHA-1, SHA-256, SHA-384 or SHA-512 digest as lowercase hexadecimal, recomputed on every keystroke. The tool encodes the text as UTF-8 and hands the bytes to crypto.subtle.digest, the same implementation browsers use for TLS and WebAuthn — so the result is exactly what sha256sum would print for the same bytes. Nothing is uploaded; the digest is computed locally.

How to use it

  1. Paste the text into the Text box. Everything you type counts, including trailing spaces and line breaks.
  2. Pick the Algorithm (SHA-256 is preselected).
  3. Read the digest in the panel below and click Copy.

To hash several variants, just edit the text — the digest updates live, so you can watch how a single changed character produces a completely different output (the avalanche effect).

Algorithm reference

AlgorithmDigest sizeHex lengthStatus (2025)Typical use
MD5128 bit32Broken — collisions in secondsLegacy checksums only; not available here
SHA-1160 bit40Broken for collisions (SHAttered, 2017)Git object IDs, legacy systems; avoid for security
SHA-256256 bit64SecureTLS certificates, Bitcoin, content hashes, HMAC keys, JWT HS256/RS256
SHA-384384 bit96SecureSubresource Integrity (sha384-…), ECDSA P-384
SHA-512512 bit128SecureLong-term integrity, faster than SHA-256 on 64-bit CPUs

SHA-256, 384 and 512 are the SHA-2 family; SHA-384 is SHA-512 truncated with different initial values. Browsers can verify integrity="sha256-…", sha384-… and sha512-… attributes, but the value there is Base64 of the raw bytes, not hex — pipe the digest through the Base64 converter after converting hex to bytes, or use openssl dgst -sha384 -binary file.js | openssl base64 -A.

Known answers to sanity-check against

InputAlgorithmDigest
(empty string)SHA-256e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
abcSHA-256ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad
abcSHA-1a9993e364706816aba3e25717850c26c9cd0d89d

Clear the text box and you will see the famous e3b0c442… empty-string digest. If a build or verification step shows that value, it hashed nothing — usually a missing file or an empty variable.

What hashes are — and are not — good for

A cryptographic hash is a one-way, fixed-size fingerprint: the same input always gives the same digest, a tiny change gives an unrelated one, and finding an input for a given digest is infeasible. That makes it right for:

  • Integrity checks — compare the digest of a download with the one the publisher lists.
  • Content addressing and cache keys — name a file by its SHA-256 and you get deduplication for free.
  • Commit signatures and Merkle trees — Git, package lockfiles, blockchains.
  • HMAC — hashing with a secret key for message authentication (JWT HS256 is HMAC-SHA256).

It is not encryption (there is no key and no way back), and it is not a password store. Hashing is designed to be fast, which is the opposite of what password storage needs; use Argon2id, bcrypt or scrypt with a per-user salt and a cost factor tuned to roughly 100 ms. Likewise, hashing an email address or phone number does not anonymize it — the input space is small enough to enumerate.

Hashing in your own code

The browser call is the same one this tool makes:

async function sha256Hex(text: string): Promise<string> {
  const bytes = new TextEncoder().encode(text);
  const digest = await crypto.subtle.digest('SHA-256', bytes);
  return [...new Uint8Array(digest)].map((b) => b.toString(16).padStart(2, '0')).join('');
}

crypto.subtle is only available in secure contexts (HTTPS or localhost). In Node, createHash('sha256').update(text).digest('hex') from node:crypto is equivalent and also offers MD5.

  • Base64 encoder / decoder — Subresource Integrity and many APIs want digests as Base64 rather than hex.
  • UUID generator — when you need a random identifier rather than a fingerprint of existing data.
  • JWT decoder — see where HMAC-SHA256 is used in practice.
  • Text diff — two strings hash differently and you cannot see why? Diff them to find the invisible character.
  • Number base converter — read a hex digest’s bytes as decimal or binary.

FAQ

Which hash algorithm should I use?

SHA-256 is the safe default for integrity checks, content addressing and signatures. Pick SHA-512 if you want a longer digest or run on 64-bit servers where it is often faster. Avoid SHA-1 for anything security-related — collisions have been demonstrated since 2017.

Is the text I hash sent anywhere?

No. Hashing uses the browser's native Web Crypto API (crypto.subtle.digest) and nothing leaves the page, so it is safe to hash sensitive strings here.

Why is MD5 not offered?

The Web Crypto API deliberately does not implement MD5 because it is cryptographically broken. If you need an MD5 checksum to match a legacy system, use a command-line tool such as md5sum or openssl.

Can I use this to hash passwords for storage?

No. Plain SHA-256 is far too fast — a GPU can try billions of guesses per second. Store passwords with a slow, salted algorithm designed for it — Argon2id, bcrypt or scrypt — and never a bare SHA digest.

Why does my hash differ from the one my terminal gives?

Almost always a trailing newline — echo adds one, so echo abc | sha256sum hashes four bytes, not three. Use printf or echo -n to compare. Also check for CRLF line endings and leading or trailing spaces.

Can I hash a file with this tool?

Not directly — it hashes the text you paste as UTF-8 bytes. Opening a binary file as text would change the bytes. For files, use sha256sum, certutil -hashfile or shasum -a 256 on the command line.

Is the output upper or lower case, and does it matter?

Lowercase hex. Case does not change the value — compare case-insensitively or lowercase both sides, as most verification tools do.