SHA-256 Hash Generator
Compute SHA-256 (and SHA-1, SHA-384, SHA-512) cryptographic hashes of any text. NIST FIPS 180-4 compliant via the browser Web Crypto API. 100% client-side.
0 chars · 0 bytes UTF-8
About SHA-256
SHA-256 is a cryptographic hash function from the SHA-2 family, standardized by NIST in FIPS 180-4. It maps an input of any length to a fixed 256-bit (32-byte) digest, conventionally written as 64 lowercase hexadecimal characters. The function is deterministic, fast, and designed so that any change to the input — even one bit — produces a completely different-looking output (the avalanche property).
Internally, SHA-256 processes the input in 512-bit blocks through 64 rounds of bitwise operations, modular additions, and a fixed schedule of constants derived from the cube roots of the first 64 primes. The construction follows the Merkle–Damgård paradigm: each block updates an internal state, and the final state becomes the digest.
When to Use SHA-256
- Integrity checks — verifying that a downloaded file matches a published checksum. Most software releases ship a
.sha256file alongside binaries. - TLS certificates — modern X.509 certificates use SHA-256 (or stronger) for their signature algorithm. SHA-1 was deprecated in 2017.
- Git commit and blob IDs — Git is migrating from SHA-1 to SHA-256 for object hashing.
- Bitcoin and many blockchains — block headers and transaction IDs are hashed with SHA-256, often double-hashed.
- HMAC-SHA-256 — keyed hashing for API signing (AWS Signature V4, Stripe webhooks, GitHub webhooks).
- Content-addressable storage — IPFS, Git, and many caching layers use the hash as the content identifier.
When NOT to Use SHA-256
Password storage is the biggest misuse. SHA-256 is fast on purpose — a modern GPU computes billions per second — which means an attacker who steals your password database can brute-force weak passwords in minutes. Use a deliberately slow password hashing function: Argon2id is the current recommendation (winner of the 2015 Password Hashing Competition), with bcrypt and scrypt as well-tested alternatives. Always combine with a per-user random salt.
Authentication of arbitrary messages without a key is also a mistake. If an attacker controls the hashed value, simply hashing it proves nothing about who wrote it. Use HMAC (hash-based message authentication code) with a secret key shared between sender and receiver, or a digital signature scheme like Ed25519 if you need public verification.
Common Pitfalls
Encoding mismatches are the #1 cause of "but the hashes don't match!" bug reports. Hashing depends on the exact byte sequence. "hello" in UTF-8 is five bytes; in UTF-16 LE it is ten bytes; with a BOM it is even longer. Always agree on an encoding (UTF-8 with no BOM is the modern default).
Trailing newlines and CRLF vs LF sneak into file checksums. Verifying a downloaded file? Hash the raw bytes, not text loaded through a line-ending-converting reader. Git hooks and editors silently rewrite line endings on Windows.
Length-extension attacks apply to plain SHA-256 (and SHA-512) when used naively as a MAC: SHA256(secret || message) is forgeable because an attacker who knows the digest and the message length can append data and recompute a valid hash. Always use HMAC-SHA-256 instead.
Code Examples
// JavaScript (browser, Web Crypto)
const buf = new TextEncoder().encode("hello")
const hash = await crypto.subtle.digest("SHA-256", buf)
const hex = [...new Uint8Array(hash)].map(b => b.toString(16).padStart(2,"0")).join("")
// "2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824"
// Node.js
import { createHash } from "node:crypto"
createHash("sha256").update("hello").digest("hex")
// Python
import hashlib
hashlib.sha256(b"hello").hexdigest()
// shell (Linux / macOS)
echo -n "hello" | sha256sum
echo -n "hello" | shasum -a 256Frequently Asked Questions
What is SHA-256?
SHA-256 is a cryptographic hash function in the SHA-2 family, designed by the NSA and standardized by NIST in FIPS 180-4. It produces a 256-bit (32-byte) digest, shown here as 64 hex characters. SHA-256 underpins TLS certificates, Git commit IDs, Bitcoin block headers, package checksums, and many integrity-verification systems.
Is SHA-256 reversible?
No. SHA-256 is a one-way function — given a digest, there is no practical way to recover the original input. The only attacks are brute force against weak or low-entropy inputs (short passwords, dictionary words). For password storage specifically, use a slow password hash like bcrypt, scrypt, or Argon2id with a per-user salt instead of plain SHA-256.
Is SHA-256 still secure in 2026?
Yes. As of 2026, no practical preimage or collision attacks against SHA-256 are known. NIST and the NSA CNSA Suite still recommend SHA-256, SHA-384, and SHA-512 for general cryptographic use. SHA-1 and MD5 are broken — there are real-world collisions for both — and should never be used for anything security-sensitive.
Why does my hash differ from another tool?
Usually because of invisible differences in the input: a trailing newline, Windows CRLF vs Unix LF line endings, a UTF-8 byte-order mark, or extra whitespace. SHA-256 is bit-exact — a single bit flip changes about half the output bits. When matching hashes, normalize line endings and strip BOMs before hashing.
Is my input sent to a server?
No. BytePane uses the browser-native Web Crypto API (crypto.subtle.digest), which runs entirely on your device. You can confirm in the Network tab of DevTools — no requests are made while you compute hashes. The tool is safe for hashing tokens, secrets, and other sensitive values.
How does SHA-256 differ from SHA-1 and MD5?
MD5 produces 128 bits and was broken by collision attacks in 2004. SHA-1 produces 160 bits and was practically broken in 2017 (Google’s SHAttered attack). SHA-256 produces 256 bits, is part of SHA-2, and remains secure. SHA-3 (Keccak) is a different family standardized in 2015 with a separate internal construction.
Should I use SHA-256 for password storage?
No. Plain SHA-256 is too fast — modern GPUs compute billions of SHA-256 hashes per second, making brute-force feasible against leaked password databases. Use Argon2id (recommended), bcrypt, or scrypt with per-user salts. SHA-256 is fine for non-password integrity, file checksums, and HMAC-SHA-256 authentication.