SHA-256 & SHA-512 Hash Generator Online | Text & File Checksum Calculator
Hash Functions How It Works
What Is SHA?
The Secure Hash Algorithm (SHA) family is a set of cryptographic hash functions standardized by NIST. SHA-256 and SHA-512 are part of the SHA-2 family, producing 256-bit and 512-bit digests respectively. They are one-way functions — computing the hash is fast, but recovering the input from the hash is computationally infeasible.
When to Use SHA
- File integrity verification — compare computed hash against published checksums to detect corruption or tampering
- Digital signatures — hash the message first, then sign the digest (signing raw data is too slow)
- Password storage — use SHA-256/512 as part of a KDF (e.g., PBKDF2), never store raw hashes
- Blockchain & certificates — SHA-256 is the default hash for Bitcoin, TLS certificates, and Git
- Data deduplication — use hashes as fingerprints to detect duplicate files
SHA Algorithm Reference
| Algorithm | Output Size | Hex Length | Speed (64-bit) | Status | Best for |
|---|---|---|---|---|---|
| SHA-1 | 160-bit (20 bytes) | 40 chars | Fast | Deprecated (collision attacks) | Legacy checksums only |
| SHA-224 | 224-bit (28 bytes) | 56 chars | Fast | Secure but uncommon | Truncated SHA-256 variant |
| SHA-256 | 256-bit (32 bytes) | 64 chars | Fast | Current standard | File checksums, blockchain, TLS |
| SHA-384 | 384-bit (48 bytes) | 96 chars | Faster on 64-bit | Current standard | High-security applications |
| SHA-512 | 512-bit (64 bytes) | 128 chars | Faster on 64-bit | Current standard | Maximum security, password KDFs |
| SHA3-256 | 256-bit (32 bytes) | 64 chars | Comparable | Current standard | Alternative to SHA-2 |
Standards Compliance
- FIPS 180-4 — NIST specification for SHA-2 (SHA-224, SHA-256, SHA-384, SHA-512)
- FIPS 202 — NIST specification for SHA-3 (SHA3-224, SHA3-256, SHA3-384, SHA3-512)
- RFC 6234 — US Secure Hash Algorithms (SHA-224 through SHA-512)
- Web Crypto API — W3C standard for browser-native SHA hashing via
crypto.subtle.digest()
Last updated:
Code Examples
JavaScript (Browser — Web Crypto API)
// SHA-256 hash of text
const message = new TextEncoder().encode('hello world');
const hashBuffer = await crypto.subtle.digest('SHA-256', message);
const hashArray = Array.from(new Uint8Array(hashBuffer));
const hashHex = hashArray.map(b => b.toString(16).padStart(2, '0')).join('');
console.log(hashHex); // b94d27b9... Python
import hashlib
# SHA-256
hash_hex = hashlib.sha256(b'hello world').hexdigest()
print(f'SHA-256: {hash_hex}')
# SHA-512
hash_512 = hashlib.sha512(b'hello world').hexdigest()
print(f'SHA-512: {hash_512}') Go
package main
import (
"crypto/sha256"
"crypto/sha512"
"encoding/hex"
"fmt"
)
func main() {
data := []byte("hello world")
sum256 := sha256.Sum256(data)
fmt.Println("SHA-256:", hex.EncodeToString(sum256[:]))
sum512 := sha512.Sum512(data)
fmt.Println("SHA-512:", hex.EncodeToString(sum512[:]))
} Rust
use sha2::{Sha256, Sha512, Digest};
fn main() {
let data = b"hello world";
let result = Sha256::digest(data);
println!("SHA-256: {:x}", result);
let result = Sha512::digest(data);
println!("SHA-512: {:x}", result);
} Node.js
const crypto = require('crypto');
const hash256 = crypto.createHash('sha256')
.update('hello world')
.digest('hex');
console.log('SHA-256:', hash256);
const hash512 = crypto.createHash('sha512')
.update('hello world')
.digest('hex');
console.log('SHA-512:', hash512); Common Pitfalls
Security Notes
Disclaimer
This tool is provided for educational and development purposes. While SHA-256 and SHA-512 are cryptographically secure hash functions, always follow NIST guidelines and consult a security professional for production deployments. Hash computation occurs entirely in your browser — no data is sent to any server.
Further Reading
- NIST FIPS 180-4 — Secure Hash Standard (SHA-2)
- NIST FIPS 202 — SHA-3 Standard
- RFC 6234 — US Secure Hash Algorithms
- Wikipedia — SHA-2
Related Concepts
- SHA-256 vs SHA-512: Which Should You Choose?
- HMAC — Message Authentication with a Secret Key
- Key Derivation Functions (KDF) — Password-Based Hashing
- Multi-Algorithm Hash Comparison
Related Tools
Need to compare two hashes side by side? Try the Hash Compare tool. For HMAC generation with a secret key, see the HMAC Generator. You can also derive keys from passwords using the KDF Hash Generator.
Frequently Asked Questions
What is the difference between SHA-256 and SHA-512?
SHA-256 produces a 256-bit (32-byte) hash displayed as 64 hex characters, while SHA-512 produces a 512-bit (64-byte) hash displayed as 128 hex characters. SHA-512 offers a higher security margin and can be faster on 64-bit processors. For most use cases, SHA-256 is sufficient and more widely supported.
Is SHA-256 reversible?
No. SHA-256 is a one-way function — you cannot recover the original input from its hash. This property makes it ideal for storing password hashes, verifying data integrity, and generating digital signatures.
Can I hash a file instead of text?
Yes. Switch to the "File" tab and upload one or more files. The tool reads each file locally in your browser and computes its hash — perfect for verifying downloaded files against published checksums. Multiple files are supported with CSV export.
Why does the hash change when I switch input encoding?
SHA algorithms operate on bytes, not characters. UTF-8, Hex, and Base64 encodings produce different byte sequences from the same visible text. For example, typing "616263" in Hex mode hashes the bytes [0x61, 0x62, 0x63] (which is "abc"), while in UTF-8 mode it hashes the ASCII bytes for the characters "6", "1", "6", "2", "6", "3".
When should I use Base64 output instead of hex?
Hex output is standard for checksums, file verification, and blockchain. Base64 output is more compact and is commonly used in APIs, JWT tokens, and protocols where shorter strings are preferred.
Privacy: This tool runs entirely in your browser — nothing is uploaded or stored. · Disclaimer: For educational purposes only. Not professional security advice.
More in Hash
Hash Compare
Compute and compare SHA-1, SHA-256, SHA-384, and SHA-512 hashes side by side online. Hex/Base64 output for checksum verification.
HMAC Generator
Generate HMAC (Hash-based Message Authentication Code) online with SHA-256/384/512. UTF-8/Hex/Base64 input and output, real-time computation.
Bcrypt Hash Generator
Generate and verify bcrypt password hashes online. Adjustable cost factor (4-20), real bcryptjs implementation, Node.js compatible.
Merkle Tree Generator
Build Merkle trees and generate proofs online. SHA-256, SHA-512, Keccak-256. Bitcoin duplicate & promote odd-leaf, OpenZeppelin sorted pairs.