SHA-256 & SHA-512 Hash Generator Online | Text & File Checksum Calculator
Hash Functions How It Works
This tool computes SHA-256 or SHA-512 hashes in real time
using the browser's built-in crypto.subtle.digest() API — the same Web Crypto API
used by security professionals. Select your algorithm, enter text or upload files for batch
hashing with CSV export, and choose between UTF-8, Hex, or Base64 input encoding. Results
appear instantly in Hex or Base64 format.
Algorithm Comparison
| Algorithm | Output Size | Hex Length | Speed (64-bit) | Best for |
|---|---|---|---|---|
| SHA-256 | 256-bit (32 bytes) | 64 chars | Fast | File checksums, blockchain, TLS |
| SHA-512 | 512-bit (64 bytes) | 128 chars | Faster on 64-bit | High-security hashing, password KDFs |
Code Examples
Compute SHA-256 hash with Web Crypto API:
// Browser — SHA-256 hash
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 — SHA-256 hash
import hashlib
hash = hashlib.sha256(b'hello world').hexdigest()
print(hash) # b94d27b9... Security Notes
- SHA-256 is collision-resistant — no practical collision attacks exist; suitable for digital signatures and certificates.
- Never use SHA-1 for new projects — it is deprecated and vulnerable to collision attacks since 2017.
- Hashing is not encryption — SHA hashes are one-way functions; you cannot recover the original input.
- For password storage, use a KDF — SHA-256 alone is too fast for password hashing; use bcrypt, scrypt, or Argon2.
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.