Hash Generator

Generate MD5, SHA-1, SHA-256, and SHA-512 hashes from text.

Hash Algorithm Comparison

AlgorithmOutput SizeSecurityUse Case
MD5128 bitsBrokenChecksums only
SHA-1160 bitsWeakLegacy systems
SHA-256256 bitsStrongGeneral purpose
SHA-512512 bitsStrongHigh security

Code Examples

// Using Web Crypto API (SHA-256)
async function sha256(text) {
  const encoder = new TextEncoder();
  const data = encoder.encode(text);
  const hash = await crypto.subtle.digest('SHA-256', data);
  return Array.from(new Uint8Array(hash))
    .map(b => b.toString(16).padStart(2, '0')).join('');
}

Frequently Asked Questions

Which hash algorithm should I use?

For security: use SHA-256 or SHA-512. SHA-1 and MD5 are cryptographically broken. For checksums (non-security): MD5 is fast and widely supported.

Can hashes be reversed?

Hashes are one-way functions and cannot be reversed. However, common values can be looked up in rainbow tables. Always use salted hashes for passwords.

Why do different tools give different hashes for the same input?

Check encoding (UTF-8 vs ASCII), line endings (LF vs CRLF), and whether there's a trailing newline. These differences change the hash completely.

Related Tools