b2KIT

SHA-256 Hash Generator

Generate SHA-256 cryptographic hash digests from text or file input using the WebCrypto API.

Tested tool guide Tested browser tools Checked August 16, 2026

What SHA-256 Hash Generator does, with a checked example

This tool computes the SHA-256 digest of whatever you give it: text typed into a box, or the raw bytes of a selected file. It runs entirely in the browser on the WebCrypto API, so nothing you hash is uploaded anywhere. SHA-256 returns exactly 64 lowercase hexadecimal characters for any input, from an empty string to a multi-gigabyte file, and the same input always returns the same digest. The thing users most often get wrong: pasting text and hashing a file containing that same text usually produce different digests, because the file contributes encoding bytes, line endings, and possibly a byte-order mark that the text box does not.

Worked example

A concrete input and expected output from the current implementation.

Input

abc

Expected output

ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad

SHA-256 of the three bytes 0x61, 0x62, 0x63. The value is the published FIPS 180-4 test vector for "abc", so it doubles as a self-check: any correct SHA-256 implementation returns exactly this digest.

How the result is produced

1

Text and file inputs

Typed text is encoded to UTF-8 bytes and hashed; a selected file is read as raw bytes and hashed unchanged, so a byte-order mark, CRLF line endings, or a trailing newline all change the result. The WebCrypto API's digest operation performs the computation, and the resulting 32-byte digest is rendered as 64 lowercase hexadecimal characters.

2

Deterministic and one-way

SHA-256 involves no key, salt, or randomness, so identical input always yields the identical digest, and the input cannot be recovered from the digest. Finding two different inputs that collide is believed to require on the order of 2^128 attempts, which is why a matching digest is treated as strong evidence the bytes are identical.

Good uses

  • Verifying a downloaded file: compare its digest against the SHA-256 checksum published on the vendor's download page before installing or running it.
  • Confirming two copies of a file are byte-identical: a backup, an upload, or a synced folder that shares a digest is the same file, whatever its name or reported size.
  • Committing to a secret without revealing it: publish the hash of a value now, reveal the value later, and anyone can hash the revealed value to confirm it matches.

Limits and checks

  • Encoding changes the digest: the same visible text hashed as UTF-16, or a file saved with a BOM or CRLF endings, gives a different result. A checksum matches only when the underlying bytes match.
  • Not a password hasher: SHA-256 is fast and unsalted, so short or common passwords fall to dictionary and brute-force attacks. For password storage use a key-derivation function such as bcrypt, scrypt, or Argon2.
  • Integrity is not authenticity: a matching digest proves your file matches whoever published the checksum, not that the file is safe. An attacker who controls the download page can publish a matching hash for a tampered file.

Common questions

Can I reverse the hash to recover the original text?

No. SHA-256 is a one-way function, and no algorithm reverses it. The only way to "recover" an input is to guess candidates (dictionary words, brute-force strings) and hash each one until a digest matches, which is practical only for short, predictable inputs such as weak passwords.

Why does the same sentence give a different hash here than in another tool?

Most likely a byte-level difference: the other tool appended a trailing newline, encoded the text as UTF-16, or hashed a file whose line endings differ from yours. SHA-256 is deterministic, so identical bytes always produce the same digest; compare the exact bytes each tool hashed rather than the visible text.

References and verification

The example and behavioral notes were checked against the browser implementation. Standards and primary references below define the relevant format, formula, or platform behavior.

Related Tools