Xerobit

SHA-256 Hash Generator

Enter any text to compute its SHA-256 hash. This sha256 hash generator implements the full FIPS 180-4 algorithm in pure TypeScript, so every calculation runs locally in your browser and nothing is uploaded to a server.

Result

e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
  • SHA-256
    e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
  • Input length
    0 bytes

How to use the sha-256 hash generator

  1. Type or paste your text into the Text to hash field.
  2. Choose lowercase or UPPERCASE hexadecimal from the format dropdown.
  3. The SHA-256 digest appears instantly as you type.
  4. Copy the 64-character hash for use in checksums, signatures or integrity checks.

How SHA-256 works

SHA-256 processes input as a stream of bytes. The message is padded so its length becomes a multiple of 512 bits (64 bytes). Padding appends a single 1-bit, then enough 0-bits, and finally the original message length as a 64-bit big-endian integer.

The padded message is split into 512-bit blocks. Each block expands into 64 words of 32 bits through a message schedule. Eight working variables, initialized with fixed constants derived from the square roots of the first eight primes, are updated across 64 rounds using bitwise operations, modular addition and six logical functions defined in FIPS 180-4.

For example, hashing the three-byte string abc produces exactly one padded block. After 64 rounds the final state yields the digest ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad.

FIPS 180-4 test vectors

The National Institute of Standards and Technology publishes test vectors to verify implementations. Use these vectors to check any SHA-256 implementation.

InputSHA-256 digest
(empty string)e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
abcba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad
abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq248d6a61d20638b8e5c026930c3e6039a33ce45964ff2167f6ecedd419db06c1

If you need to verify a file or string against a known digest, use the hash checker tool to compare values side by side.

Common uses for SHA-256

SHA-256 is the default hash in many security protocols. It underpins TLS certificate signatures, Bitcoin transaction identifiers, Git object addressing and code-signing manifests. Developers also use it to generate checksums for downloaded files so users can confirm integrity.

When you need a keyed hash for API authentication or message verification, look at the HMAC SHA-256 tool instead. HMAC combines a secret key with SHA-256 to prevent length-extension attacks that plain hashing cannot resist.

For legacy systems that still rely on older algorithms, the SHA-1 hash generator and MD5 hash generator are available, though neither should be used for new security designs.

Edge cases and common mistakes

A frequent mistake is hashing the UTF-16 representation of a string instead of its UTF-8 bytes. JavaScript stores strings internally as UTF-16 code units, so passing a raw string to a naive byte reader produces an incorrect digest. This sha256 hash generator encodes all input as UTF-8 before hashing, matching the behavior of command-line tools like sha256sum and OpenSSL.

Another pitfall involves trailing newlines. When you run echo "abc" | sha256sum in a terminal, the shell appends a newline character, making the actual input four bytes (abc\n). The resulting hash differs from hashing the three bytes abc alone. Always be explicit about whether your input includes line endings.

Very large inputs are handled correctly because the algorithm processes data in 64-byte chunks. However, extremely long strings may consume noticeable memory in the browser since the entire input must exist as a JavaScript string before encoding.

SHA-256 compared to other hash functions

SHA-256 produces a 256-bit (32-byte) digest, typically displayed as 64 hexadecimal characters. It belongs to the SHA-2 family alongside SHA-512, which uses 64-bit words and produces a 512-bit digest. SHA-256 is preferred on 32-bit architectures, while SHA-512 performs better on 64-bit systems.

The newer SHA-3 family uses a sponge construction rather than Merkle-Damgard. If your project requires SHA-3, use the SHA-3 hash generator. For non-cryptographic needs such as hash tables or fast checksums, consider the FNV hash or Adler-32, both of which trade collision resistance for speed.

Worked examples

ExampleInputResult
Empty stringOutput format: hex-lowerSHA-256: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855; Input length: 0 bytes
The word "abc"Text to hash: abc; Output format: hex-lowerSHA-256: ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad; Input length: 3 bytes
NIST test vectorText to hash: abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq; Output format: hex-lowerSHA-256: 248d6a61d20638b8e5c026930c3e6039a33ce45964ff2167f6ecedd419db06c1; Input length: 56 bytes
Uppercase outputText to hash: hello; Output format: hex-upperSHA-256: 2CF24DBA5FB0A30E26E83B2AC5B9E29E1B161E5C1FA7425E73043362938B9824; Input length: 5 bytes

FAQ

Is this sha256 hash generator secure?

Your text stays private: all computation happens locally in your browser using a pure TypeScript implementation of FIPS 180-4, and nothing is sent to a server. SHA-256 on its own is not a password storage scheme, so use bcrypt, scrypt or Argon2 for stored passwords.

Can SHA-256 be reversed or decrypted?

No. SHA-256 is a one-way function. Given only the 64-character hex digest, recovering the original input is computationally infeasible.

Why does my hash differ from the command line?

Terminal commands like echo often append a newline character. Make sure the exact same bytes, including or excluding trailing whitespace, are being hashed.

Does this tool handle Unicode and emoji?

Yes. Input is encoded as UTF-8 before hashing, so any Unicode character including emoji produces the correct standard digest.

What is the difference between SHA-256 and HMAC-SHA-256?

SHA-256 hashes data without a key. HMAC-SHA-256 combines a secret key with the hash to authenticate messages. Use the HMAC SHA-256 tool when you need keyed verification.

How long is a SHA-256 hash?

The output is always 256 bits, which equals 32 bytes or 64 hexadecimal characters regardless of input size.