DevTools

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

Generate MD5, SHA-1, SHA-256, SHA-384, and SHA-512 hashes for any text, all side by side. Paste a known hash below to verify integrity.

Compare
MD5
SHA-1
SHA-256
SHA-384
SHA-512

What Is a Hash Function?

A cryptographic hash function is an algorithm that takes input data of arbitrary length and produces a fixed-length output called a digest or hash. The same input always produces the same digest (deterministic), and even a single character change produces a completely different output — a property known as the avalanche effect.

Hash functions are one-way: given a digest, it is computationally infeasible to recover the original input. This makes them fundamentally different from Base64 Converter encoding, which is a reversible transformation used only for transport safety. Common algorithms include MD5 (128-bit, 32 hex characters), SHA-1 (160-bit, 40 hex characters), SHA-256 (256-bit, 64 hex characters), and SHA-512 (512-bit, 128 hex characters).

MD5 and SHA-1 are no longer considered secure against collision attacks — an attacker can craft two different inputs that share the same digest. For security-sensitive uses such as digital signatures, certificate fingerprints, or password verification, SHA-256 or SHA-512 from the SHA-2 family should be used. MD5 remains practical for non-security tasks like cache keys, deduplication, and checksums where collision resistance is not required. This online hash generator supports all four algorithm families so you can compare outputs side by side.

How to Generate a Hash Online

  1. 1
    Paste or type your text. Input appears in the text box. Short text updates instantly; longer input is debounced 150ms to keep typing smooth.
  2. 2
    Compare results live. All five hashes (MD5, SHA-1, SHA-256, SHA-384, SHA-512) are computed in parallel and shown side by side as you type.
  3. 3
    Copy or verify. Copy the hash you need with its row button, or paste a known hash into the Compare field — the matching row highlights green.

Hash Algorithm Comparison

Using this hash generator requires no installation or account. Type or paste any string into the input field and all five digests — MD5, SHA-1, SHA-256, SHA-384, and SHA-512 — appear side by side. Computation runs entirely in your browser (Web Crypto API for the SHA family, crypto-js for MD5), so your text is never sent to a server.

Having every algorithm visible at once is the difference between this tool and most competitors: choose MD5 for fast checksums, SHA-1 for legacy compatibility, SHA-256 for general security work, SHA-384 or SHA-512 when a larger output space is required — no need to switch tabs. Paste a known hash into the Compare field and the matching row highlights green, letting you verify integrity against any algorithm without guessing which was used.

MD5 vs SHA-1 vs SHA-256 vs SHA-512: Which Should You Use?

Pick the weakest function that still satisfies your requirement — both speed and digest size rise as you move up the list. MD5 (128-bit) is the fastest and smallest. It is cryptographically broken (practical collisions exist) but perfectly fine for non-adversarial uses like cache keys, content deduplication, and detecting accidental file corruption. SHA-1 (160-bit) is also collision-broken: treat it as legacy-only, for interoperating with existing systems such as older Git object IDs, and never for new signatures.

SHA-256 (256-bit) is the sensible default for anything security-relevant: certificate fingerprints, digital signatures, blockchain, and integrity verification of downloads. It is also the hash inside common JWT algorithms — both HS256 and RS256 signatures in a JWT Decoder are built on SHA-256. SHA-512 (512-bit) is not automatically 'more secure' for everyday threats; it offers a larger output space and is often faster than SHA-256 on 64-bit CPUs, so reach for it when hashing large data on a 64-bit server or when you want extra margin. SHA-384 is simply SHA-512 truncated to 384 bits, used where that digest length is mandated.

None of these are password hashes. To store passwords, use a deliberately slow, salted function such as bcrypt, scrypt, or Argon2 — a fast hash like SHA-256 is brute-forced at billions of guesses per second. Use this tool for checksums, fingerprints, and verification, not for hashing user credentials.

Code Examples

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

sha256("hello world").then(console.log);
// b94d27b9934d3e08a52e52d7da7dabfac484efe04294e576...
Python
import hashlib

text = "hello world"

print(hashlib.md5(text.encode()).hexdigest())
# 5eb63bbbe01eeed093cb22bb8f5acdc3

print(hashlib.sha1(text.encode()).hexdigest())
# 2aae6c69c27567b6d8e4d4d6d69b1d4d...

print(hashlib.sha256(text.encode()).hexdigest())
# b94d27b9934d3e08a52e52d7da7dabfac484efe04294e576...

print(hashlib.sha512(text.encode()).hexdigest())
Go
package main

import (
    "crypto/md5"
    "crypto/sha256"
    "fmt"
)

func main() {
    input := []byte("hello world")

    md5sum := md5.Sum(input)
    fmt.Printf("MD5:    %x\n", md5sum)

    sha := sha256.Sum256(input)
    fmt.Printf("SHA-256: %x\n", sha)
}
Bash
# SHA-256 (available on Linux and macOS)
echo -n "hello world" | sha256sum
# b94d27b9934d3e08a52e52d7da7dabfac484efe04294e576...

# MD5
echo -n "hello world" | md5sum

# SHA-512
echo -n "hello world" | sha512sum

# macOS uses shasum instead of sha256sum
echo -n "hello world" | shasum -a 256

Frequently Asked Questions

What is a hash function?

A cryptographic hash function takes input data of any size and produces a fixed-length output (called a digest). The process is deterministic and one-way — you cannot reverse a hash back to the original data.

What is the difference between MD5 and SHA-256?

MD5 produces a 128-bit (32-character) hash and is fast but considered insecure due to collision attacks. SHA-256 produces a 256-bit (64-character) hash and is currently considered secure.

Is MD5 still safe to use?

MD5 should not be used for security-critical applications like password hashing. However, it is still acceptable for checksums, cache keys, and deduplication where collision resistance is not critical.

Can I hash a file with this tool?

This tool currently hashes text input. For file hashing, you can use command-line tools like sha256sum (Linux/Mac) or CertUtil (Windows).

Can I convert an MD5 hash to SHA-256?

No. A hash is a one-way digest, not an encoding, so there is no key or algorithm that turns an existing MD5 hash into the SHA-256 hash of the same input. To get both, hash the original text again with each algorithm — paste your source text above and this tool shows the MD5, SHA-1, SHA-256, SHA-384, and SHA-512 digests side by side.

Related Developer Tools