Skip to content

Hash Generator — SHA-256, SHA-1, SHA-512 Online

Generate cryptographic hashes from any text — SHA-256, SHA-1, SHA-384, SHA-512. Free, private, and browser-based.

Last updated:

Hash will appear here...

What Is a Hash Function?

A cryptographic hash function takes an arbitrary block of data and returns a fixed-length string of characters, commonly called a digest or checksum. The process is one-way: you can compute a digest from an input, but you cannot reverse-engineer the original input from the digest. This property is what makes hashing fundamentally different from encryption.

Hash functions are deterministic — the same input always produces the same output. They also exhibit what cryptographers call the avalanche effect: changing a single bit of the input flips roughly half the bits in the output. This means that hello and Hello produce completely different digests, making it easy to detect even the smallest alteration.

Regardless of whether your input is a single character or an entire operating-system ISO, the output length is always the same for a given algorithm — 256 bits for SHA-256, 512 bits for SHA-512, and so on. This fixed-length guarantee is essential for data structures like hash tables, Merkle trees, and content-addressable storage.

SHA-256 vs SHA-1 vs SHA-512

Not every hash algorithm offers the same security or performance profile. The three algorithms developers encounter most frequently are SHA-1, SHA-256, and SHA-512, all members of the Secure Hash Algorithm family published by NIST.

  • SHA-1 produces a 160-bit (40-character hex) digest. In 2017, Google and CWI Amsterdam demonstrated a practical collision attack (SHAttered), proving that two distinct inputs can yield the same SHA-1 hash. Major browsers, certificate authorities, and Git (for new repositories) have all moved away from SHA-1. It should be considered deprecated for any security-sensitive purpose.
  • SHA-256 outputs a 256-bit (64-character hex) digest and belongs to the SHA-2 family. It is the most widely adopted hash in production systems today — used in TLS certificates, Bitcoin mining, Docker image layers, and most API signature schemes. No practical collision or pre-image attacks exist against SHA-256.
  • SHA-512 outputs a 512-bit (128-character hex) digest, also part of the SHA-2 family. It uses 64-bit arithmetic internally, which can be faster than SHA-256 on 64-bit processors. The longer digest provides a larger security margin against birthday attacks, making SHA-512 a good default when storage space for the hash is not a concern.

For most web development and DevOps work, SHA-256 strikes the best balance between security, speed, and ecosystem compatibility. Choose SHA-512 when you need a wider security margin or are running on a 64-bit platform where it benchmarks faster.

Hashing vs Encryption vs Encoding

These three operations are frequently confused, but they serve fundamentally different purposes.

  • Hashing is a one-way transformation. Given a digest, there is no key or algorithm that can recover the original input. Use hashing when you need to verify data integrity or store a fingerprint of sensitive data (e.g., passwords) without keeping the plaintext.
  • Encryption is a two-way transformation that requires a key. AES, RSA, and ChaCha20 are encryption algorithms — the recipient can decrypt the ciphertext back to the original message using the correct key. Use encryption when data must travel securely and be read on the other side.
  • Encoding is a reversible format conversion with no secret involved. Base64, URL encoding, and hex encoding transform data so it can travel safely through text-based protocols, but they provide zero confidentiality. Anyone can decode the result without a key.

A common mistake is to Base64-encode a password and treat it as "encrypted." Base64 is trivially reversible — it is encoding, not encryption, and certainly not hashing. When protecting passwords, always hash them with a purpose-built algorithm like bcrypt or Argon2, never encode or encrypt them.

Common Use Cases for Hashing

Hashing appears across nearly every layer of modern software infrastructure:

  • File integrity and checksums. Download pages often list a SHA-256 digest next to each file. After downloading, you hash the file locally and compare digests. If they match, the file was not tampered with or corrupted in transit.
  • Password storage. Storing plaintext passwords is a critical vulnerability. Instead, applications hash the password (ideally with a slow, salted algorithm like bcrypt or Argon2) and store only the digest. During login, the submitted password is hashed again and compared to the stored digest.
  • Digital signatures. TLS, code signing, and JWT all hash the payload before signing it with a private key. The recipient hashes the payload independently and verifies the signature against the public key, confirming both integrity and authenticity.
  • Content-addressable storage. Git identifies every commit, tree, and blob by its SHA hash. IPFS uses multihashes to address files across a decentralized network. Docker image layers are referenced by their content digest. In each case, the hash is the address — identical content always resolves to the same identifier.

Related Tools

If you are working with hashes and cryptographic primitives, these companion tools on CodeBoxTools may help:

  • Bcrypt Generator — hash passwords with bcrypt, a slow-by-design algorithm that includes a built-in salt and configurable cost factor, purpose-built for secure password storage.
  • Password Generator — generate strong, random passwords that resist brute-force and dictionary attacks before you hash and store them.
  • Base64 Encode / Decode — a reversible encoding tool, useful for understanding the critical difference between encoding and hashing discussed above.

Frequently Asked Questions

What hash algorithm should I use?
SHA-256 is the most widely used and recommended for general purposes. SHA-1 is considered weak and should only be used for legacy compatibility. SHA-512 provides a longer hash for higher security requirements.
Can I reverse a hash?
No. Cryptographic hashes are one-way functions — you cannot recover the original input from a hash. That's by design.
Is this secure?
Yes. This tool uses the Web Crypto API, the same cryptographic library used by browsers for HTTPS. All computation happens locally in your browser.
Which hash algorithms are supported?
SHA-1, SHA-256, SHA-384, and SHA-512 via the Web Crypto API. MD5 is not supported because the Web Crypto standard deliberately omits it — MD5 is cryptographically broken and should not be used for security purposes.
Can I use SHA-256 for password hashing?
No. SHA-256 is too fast, which makes brute-force attacks cheap. Use a dedicated password hash like bcrypt, Argon2, or scrypt instead. See our Bcrypt Generator for password hashing.
Is the output hex or Base64?
Hex, lowercase, no separators — matching `shasum`, `sha256sum`, and most programming libraries. For Base64 output, run the hex value through our Base64 tool.

Related Tools