SHA-256 & SHA-512 Hash Generator Online | Text & File Checksum Calculator

Hash Functions
100% client-side. Processed locally in your browser using the Web Crypto API. Nothing is sent to any server.

How It Works

SHA-256 is the current industry standard. Never use SHA-1 for security purposes — it has been vulnerable to collision attacks since 2017 (Google SHAttered). SHA-256 is suitable for digital signatures, certificates, and blockchain. For password storage, use a dedicated KDF (bcrypt, scrypt, Argon2), not raw SHA hashes.

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

AlgorithmOutput SizeHex LengthSpeed (64-bit)StatusBest for
SHA-1160-bit (20 bytes)40 charsFastDeprecated (collision attacks)Legacy checksums only
SHA-224224-bit (28 bytes)56 charsFastSecure but uncommonTruncated SHA-256 variant
SHA-256256-bit (32 bytes)64 charsFastCurrent standardFile checksums, blockchain, TLS
SHA-384384-bit (48 bytes)96 charsFaster on 64-bitCurrent standardHigh-security applications
SHA-512512-bit (64 bytes)128 charsFaster on 64-bitCurrent standardMaximum security, password KDFs
SHA3-256256-bit (32 bytes)64 charsComparableCurrent standardAlternative 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

Using SHA-1 for security purposes. SHA-1 has been broken since 2017 (Google SHAttered attack). Do not use it for digital signatures, certificates, or any security-critical application.
Confusing hashing with encryption. SHA hashes are one-way functions — you cannot recover the original input. If you need reversible data protection, use encryption (AES-256-GCM), not hashing.
Using raw SHA-256 for password storage. SHA-256 is too fast for password hashing, making brute-force attacks feasible. Use bcrypt, scrypt, or Argon2 which are intentionally slow.
Ignoring input encoding. SHA operates on bytes, not characters. UTF-8, Hex, and Base64 encodings of the same visible text produce different byte sequences and therefore different hashes.
Hashing large files in memory. For files larger than available RAM, use streaming hash computation. Web Crypto API does not support streaming, so use Node.js crypto.createHash() with file streams on the server side.

Security Notes

SHA-256 is collision-resistant. No practical collision attacks exist against SHA-256. It remains suitable for digital signatures, certificates, and data integrity verification.
SHA-512 is faster on 64-bit systems. If performance matters on 64-bit processors, SHA-512 can outperform SHA-256 while providing a larger security margin.
Pre-image resistance is preserved. Given a SHA-256 hash, finding an input that produces it requires ~2^256 operations — computationally infeasible with current technology.
Use for file verification. Always verify downloaded files by comparing their SHA-256 hash against the publisher's official checksum to detect tampering or corruption.

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

Related Concepts

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

Learn More