Hash Generator

Generate MD5, SHA-1, SHA-256, SHA-384, and SHA-512 hashes — one at a time or all at once

What Is a Hash Generator?

A hash generator runs text through a cryptographic hash function and shows the result, a fixed-length string of hex characters called a hash, digest, or checksum. The same input always gives the same hash, and the smallest change gives a completely different one:

SHA-256("hello") = 2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824
SHA-256("Hello") = 185f8db32271fe25f561a6fc938b2e264306ec304eda518007d1764826381969

That behavior, called the avalanche effect, is what makes hashes useful. Compare two hashes and you know whether two inputs are identical without comparing the inputs themselves. And because a hash can’t be run backwards, you can publish or store one without revealing what produced it.

This tool supports the five algorithms you’ll meet most often: MD5, SHA-1, SHA-256, SHA-384, and SHA-512.

How to Use the Hash Generator

  1. Type or paste text into the input box. The hash updates as you type.
  2. Pick an algorithm from the dropdown. SHA-256 is the default, and switching re-hashes the input immediately.
  3. Click All Hashes to see every algorithm side by side. That view stays on while you keep typing.
  4. Click Copy to put the result on your clipboard.

Keyboard shortcuts: Ctrl+Enter hashes with the selected algorithm, and Ctrl+L clears the input. Your last input is saved in your browser’s local storage, so it’s still there when you come back.

Hash Algorithm Comparison

AlgorithmOutputHex lengthPublishedSecurity statusUse it for
MD5128 bits321992Broken: collisions in secondsLegacy checksums, cache keys
SHA-1160 bits401995Broken: practical collisions since 2017Legacy systems only
SHA-256256 bits642001SecureThe default for almost everything
SHA-384384 bits962001SecureSubresource Integrity, TLS suites
SHA-512512 bits1282001SecureLarge margins, fast on 64-bit CPUs

SHA-256, SHA-384, and SHA-512 all belong to the SHA-2 family. SHA-384 is SHA-512 with different starting values and a shorter output. On 64-bit processors without dedicated SHA instructions, SHA-512 is often faster than SHA-256 because it works on 64-bit words. The newer SHA-3 standard (2015) isn’t in browsers’ Web Crypto API, so this tool doesn’t offer it.

MD5 and SHA-1: Broken, but Not Useless

“Broken” means an attacker can build two different inputs with the same hash. MD5 has been in that state since 2004. In 2012, the Flame malware used an MD5 collision to forge a Microsoft code-signing certificate. SHA-1 followed in 2017, when Google and CWI Amsterdam published two different PDF files with the same SHA-1 hash (the SHAttered attack). In 2020, researchers estimated that a chosen-prefix SHA-1 collision costs about $45,000 in rented GPU time. NIST has told agencies to stop using SHA-1 completely by the end of 2030.

Whether that matters depends on the threat. A collision attack needs someone who controls an input. So:

  • Not acceptable: signatures, certificates, software-update checks, or anything where an attacker could swap a file or message for one with the same hash.
  • Still acceptable: cache keys, deduplicating your own files, sharding by hash, and catching accidental corruption when a mirror only publishes an MD5 checksum.

Git still uses SHA-1 for object IDs, with collision detection added in 2017, and has supported a SHA-256 repository format since version 2.29. UUID versions 3 and 5 are built from MD5 and SHA-1 hashes of a name. Those are fine for IDs but not for security. The UUID Generator makes random and time-ordered UUIDs instead.

Which Hash Algorithm Should You Use?

  • General-purpose fingerprint, checksum, or content ID: SHA-256.
  • Matching a checksum someone published: whatever algorithm they used. The hash only means something if you compute it the same way.
  • Subresource Integrity (integrity="sha384-..."): SHA-384 is the common choice, but SRI wants the digest in Base64, not hex. Generate it with openssl dgst -sha384 -binary file.js | openssl base64 -A.
  • Message authentication or API signatures: HMAC-SHA256, not a bare hash (see below).
  • Passwords: none of these. Use a password hashing function.

Hashing vs Encryption vs Encoding

These three get mixed up all the time:

  • Encoding (Base64, URL encoding, hex) changes how data is written and is fully reversible by anyone, no key needed. Try the Base64 Encoder/Decoder.
  • Encryption (AES, RSA) hides data and is reversible with the right key.
  • Hashing can’t be reversed at all. Only someone who already has the input can reproduce the hash.

“MD5 decrypt” sites don’t break this. They keep huge tables of precomputed hashes for common words and leaked passwords and look your hash up. That works on password123, and it’s the main reason never to store a plain, unsalted hash of a password.

Don’t Hash Passwords with SHA-256

SHA-256 is designed to be fast, and fast is bad for passwords: a single modern GPU can test billions of SHA-256 guesses per second against a stolen hash. Password storage needs a function that is slow on purpose and salted, so every user’s hash is unique even when two of them pick the same password. The OWASP Password Storage Cheat Sheet recommends Argon2id first, then scrypt or bcrypt, and PBKDF2 where FIPS-140 compliance is required. Every mainstream language has a maintained library for these. Don’t build your own scheme out of SHA-256 and a loop. And the strongest hash can’t save a weak password, so start with the Password Generator.

HMAC: Hashing with a Secret Key

To prove that a message came from someone who holds a secret key, as with webhook signatures, signed API requests, or HS256 JWTs, use HMAC. Gluing the key onto the message and hashing it is not enough. With MD5, SHA-1, SHA-256, and SHA-512, anyone who knows hash(secret + message) and the secret’s length can compute a valid hash for the message plus extra data, without ever learning the secret. This is called a length-extension attack. HMAC’s two-pass construction prevents it:

Python:   hmac.new(key, msg, hashlib.sha256).hexdigest()
Node.js:  crypto.createHmac('sha256', key).update(msg).digest('hex')

When you verify an HMAC, compare it in constant time with hmac.compare_digest in Python or crypto.timingSafeEqual in Node.js. A plain == can leak how many leading characters matched. The JWT Generator signs tokens with HMAC-SHA256 in your browser.

Why Your Hash Doesn’t Match

When two tools give different hashes for “the same” text, the bytes are different, almost always in a way you can’t see:

  • A trailing newline from echo. echo hello | sha256sum hashes hello\n and prints 5891b5b5..., not 2cf24dba.... Use echo -n hello or printf '%s' hello.
  • Line endings. A file saved on Windows has CRLF (\r\n) line breaks. Browsers turn every line break in a text box into a plain LF (\n), so pasting a CRLF file here won’t reproduce that file’s hash. Hash the file itself instead.
  • Character encoding. This tool, Python’s str.encode(), and Node.js hash UTF-8 bytes. .NET’s Encoding.Unicode and many Windows APIs produce UTF-16, which gives a different hash for the same string.
  • Invisible characters. A leading space, a trailing tab, a non-breaking space copied from a web page, or a byte order mark at the start of a file each change the hash completely.
  • Output format. Hex case doesn’t matter (2CF24D... equals 2cf24d...), but a Base64 digest of the same hash looks completely different from the hex one.

Verify a File Checksum

This tool hashes text. For a downloaded ISO, installer, or archive, run the hash locally and compare it with the checksum on the publisher’s site:

PlatformSHA-256MD5
Linuxsha256sum file.isomd5sum file.iso
macOSshasum -a 256 file.isomd5 file.iso
Windows PowerShellGet-FileHash file.isoGet-FileHash file.iso -Algorithm MD5
Windows cmdcertutil -hashfile file.iso SHA256certutil -hashfile file.iso MD5

On Linux, sha256sum -c SHA256SUMS checks every file listed in a checksum file at once. A checksum from the same server as the download only proves the file wasn’t corrupted in transit. To prove the publisher made it, check the signature on the checksum file, usually with GPG.

Generate a Hash in Code

LanguageSHA-256 of a string, as hex
JavaScript (browser)crypto.subtle.digest('SHA-256', new TextEncoder().encode(text)), then hex-encode the bytes
Node.jscrypto.createHash('sha256').update(text).digest('hex')
Pythonhashlib.sha256(text.encode()).hexdigest()
Gofmt.Sprintf("%x", sha256.Sum256([]byte(text)))
PHPhash('sha256', $text)
Java 17+HexFormat.of().formatHex(MessageDigest.getInstance("SHA-256").digest(text.getBytes(UTF_8)))
Shellprintf '%s' "$text" | sha256sum

Swap the algorithm name for md5, sha1, sha384, or sha512 to get the others. Note that browsers’ Web Crypto API has no MD5, and crypto.subtle is only available on HTTPS pages and localhost.

Your Data Stays in Your Browser

Everything you type is hashed on your own device. SHA-1, SHA-256, SHA-384, and SHA-512 come from the browser’s built-in Web Crypto API, and MD5 from a small JavaScript implementation on this page. Nothing is uploaded, logged, or stored anywhere except your browser’s local storage, which you can wipe with Ctrl+L.

Frequently Asked Questions

What is a hash function?

A hash function turns input of any length into a fixed-length value called a hash or digest. SHA-256 always returns 256 bits (64 hex characters), whether you feed it one letter or a 4 GB file. The same input always gives the same hash, a one-character change gives a completely different hash, and there's no way to compute the input back from the output.

Can a hash be decrypted or reversed?

No. A hash isn't encrypted data, so there's no key and nothing to decrypt. Sites that offer to decrypt MD5 or SHA-1 look the hash up in a huge table of precomputed hashes of common words and leaked passwords. That works for short, guessable inputs like 'password123', which is exactly why plain hashes of passwords are unsafe. For a long or random input, a lookup finds nothing.

Should I use MD5 or SHA-256?

Use SHA-256 unless something forces you to use MD5. MD5 collisions can be computed in seconds on a laptop, so MD5 is unsafe anywhere an attacker could swap in a different file or message. It's still acceptable for non-adversarial jobs: cache keys, deduplication, and catching accidental corruption when a legacy system only publishes an MD5 checksum.

Is SHA-256 secure?

Yes. No practical collision or preimage attack is known against SHA-256 or the rest of the SHA-2 family (SHA-384, SHA-512). Finding a collision by brute force takes around 2^128 operations. SHA-256 is used in TLS certificates, code signing, Bitcoin, and Git's newer object format. What it isn't is a password hashing function, because it's designed to be fast.

Can I hash passwords with SHA-256?

Not on its own. SHA-256 is built to be fast, and a single modern GPU can try billions of SHA-256 guesses per second against a leaked hash. Store passwords with a deliberately slow, salted password hashing function instead: Argon2id first, then scrypt or bcrypt, or PBKDF2 where FIPS compliance is required. These are what the OWASP Password Storage Cheat Sheet recommends.

Why doesn't my hash match the one from the command line?

The input bytes differ, usually by something invisible. The most common cause is echo adding a trailing newline: echo hello | sha256sum hashes 'hello' plus a newline. Use echo -n or printf instead. Other causes are Windows CRLF line endings, a leading or trailing space, a byte order mark, or text encoded as UTF-16 instead of UTF-8. This tool hashes the exact UTF-8 bytes of what's in the input box.

How do I verify a file checksum?

Compute the file's hash locally and compare it with the checksum the publisher lists. On Linux run sha256sum file, on macOS run shasum -a 256 file, and in Windows PowerShell run Get-FileHash file. The algorithm must match the published one, and letter case doesn't matter because hex digests are case-insensitive. This tool hashes text, so use the command line for files.

Is my data safe?

Yes. SHA-1, SHA-256, SHA-384, and SHA-512 are computed by your browser's built-in Web Crypto API, and MD5 by a small JavaScript implementation on this page. Your text is never sent to a server.