What Is SHA-256?
SHA-256 (Secure Hash Algorithm 256-bit) is a cryptographic hash function in the SHA-2 family defined by the National Institute of Standards and Technology (NIST) in FIPS 180-4. It processes arbitrary-length input data and maps it deterministically into a fixed-size 256-bit (32-byte) digest, universally represented as a 64-character hexadecimal string.
SHA-256 is designed around the Merkle-Damgård construction with 64 compression rounds, ensuring that even a single-bit alteration in the input causes an unpredictable, avalanche-like transformation across the entire output hash.
How to Generate a SHA-256 Hash
Generating a SHA-256 hash requires four straightforward steps:
- Select Input Mode: Choose between plain string input or file upload in our SHA-256 generator tool.
- Enter Your Data: Type text into the editor or drag and drop your file. Character and byte metrics update automatically.
- Instant Client-Side Computation: The browser immediately computes the 256-bit digest locally via the Web Crypto API without uploading data.
- Copy or Verify: Copy the 64-character hexadecimal hash, switch to Base64/binary formats, or paste an expected checksum to verify matching integrity.
SHA256 Generator from File (Local Streaming)
Traditional web tools attempt to load entire multi-gigabyte files into browser memory at once, resulting in browser tab crashes. Our file hash generator uses chunked streaming via JavaScript ReadableStream and FileReader in 2MB sequential buffers.
This architecture ensures low memory consumption and support for large files. Because processing occurs entirely on your device, sensitive files, database dumps, and software binaries never leave your machine. Learn more in our guide on how file hashing works.
How to Verify a SHA-256 Checksum
Software vendors publish checksum manifests (such as SHA256SUMS) to allow users to detect corrupted downloads or malicious tampering. You can verify checksums directly using our file integrity checker or in your local operating system command line:
sha256sum file.isoshasum -a 256 file.dmgGet-FileHash file.exeRead our complete tutorial: how to verify file integrity with SHA-256.
Algorithm Comparisons: SHA-256 vs SHA-512 vs SHA-1 vs MD5
| Algorithm | Digest Length | Collision Security | Standard Status | Primary Use |
|---|---|---|---|---|
| SHA-256 | 256 bits (64 hex) | 128-bit secure | NIST FIPS 180-4 | Security, TLS, Bitcoin |
| SHA-512 | 512 bits (128 hex) | 256-bit secure | NIST FIPS 180-4 | High security 64-bit systems |
| SHA-1 | 160 bits (40 hex) | Broken (Collisions) | Deprecated | Legacy checksums only |
| MD5 | 128 bits (32 hex) | Broken (Trivial collisions) | Deprecated | Non-security file verification |
Deep-dive comparisons: SHA-256 vs SHA-512, SHA-1 vs SHA-256, and MD5 vs SHA-256.
HMAC-SHA256 vs Plain SHA-256
While standard SHA-256 verifies that data was not corrupted during transit, it cannot verify who generated the hash because anyone can compute the SHA-256 digest of arbitrary data. HMAC-SHA256 (RFC 2104) mixes a secret cryptographic key with the message via inner and outer hash pads:
HMAC(K, m) = SHA-256((K' ⊕ opad) ∥ SHA-256((K' ⊕ ipad) ∥ m))HMAC-SHA256 provides both integrity and message authentication. It is the core authentication mechanism used across GitHub webhooks, Stripe webhooks, AWS Signature Version 4, and JSON Web Tokens (JWT). Test it in our HMAC generator tool or read what is HMAC.
Security Considerations: Hashing vs Encryption & Passwords
Hashing ≠ Encryption
Encryption is a reversible two-way process requiring a decryption key (e.g. AES-256-GCM). Hashing is mathematically one-way. You cannot "decrypt" a SHA-256 hash. Learn more in our guide on hashing vs encryption.
SHA-256 and Password Storage
Do not use plain SHA-256 to hash user passwords. Because SHA-256 is fast, attackers can test billions of hashes per second using GPUs. Always use dedicated, memory-hard key derivation functions such as Argon2id, bcrypt, or scrypt.
Common Uses of SHA-256
- Software Download Verification: Linux distributions (Ubuntu, Fedora), developer tooling (Node.js, Python), and release binaries publish SHA-256 checksums to guarantee tamper-free downloads.
- Digital Signatures: Signature schemes like RSA and ECDSA compute and sign a cryptographic hash of the document rather than signing arbitrary-length payloads directly. (Note: other schemes such as Ed25519 incorporate dedicated hashing internally as part of PureEdDSA).
- Blockchain & Bitcoin Consensus: Bitcoin uses double-SHA256 (
SHA-256(SHA-256(BlockHeader))) to power its Proof-of-Work mining consensus and Merkle tree block validations. - SSL/TLS Certificates: HTTPS connections and Public Key Infrastructure (PKI) use SHA-256 within certificate signature algorithms (e.g.
SHA256withRSA).