oktools

Hash Generator

Generate MD5, SHA-1, SHA-256, SHA-384 and SHA-512 hashes of any text instantly, in hex and Base64, or enter a key to get the HMAC for each. Everything is computed right in your browser — nothing you type is uploaded.

0 characters · 0 bytes

No hashes yet

Enter some text to generate all hashes instantly.

How it works

Whatever is in the text box is turned into bytes with TextEncoder, so every digest is over UTF-8: the same bytes a UTF-8 file or a charset=utf-8 request body would hash to. The counter under the box shows both views of the input: characters are counted as Unicode code points, so an emoji is one, and bytes are counted after encoding, so é is two. Whitespace is not trimmed; a single space has a digest of its own. Every keystroke recomputes all five digests, and a request counter discards any result that lands after the text has moved on, so fast typing never leaves a stale hash on screen.

SHA-1, SHA-256, SHA-384 and SHA-512 come from the browser’s own Web Crypto implementation through crypto.subtle.digest — native code, the same the browser uses for TLS. MD5 is not part of Web Crypto, so the page carries a port of RFC 1321 that works on the byte array directly, padding the final block and spilling into a second one when fewer than eight bytes are free; it is checked against the RFC’s own test suite. Each digest is shown twice, as lowercase hex and as standard Base64 with padding, each with its own copy button, in the order MD5, SHA-1, SHA-256, SHA-384, SHA-512.

Typing anything into the key field switches every algorithm to its HMAC. The key is encoded as UTF-8 bytes like the text. For the SHA family it is imported as a raw HMAC key and the value comes from crypto.subtle.sign, while HMAC-MD5 is built in the page from the RFC 2104 construction: the key padded to the 64-byte block, or hashed first when it is longer, then XORed with 0x36 and 0x5c for the inner and outer passes. The labels change to HMAC-MD5 and so on and the heading reads All HMACs; clearing the key returns to plain digests.

Examples

Hash a string with every algorithm

These are the published test vectors for each algorithm, so any other implementation has to agree with them. The page lists the five in this order, each with a Base64 form beneath the hex, and the 128-character SHA-512 line shows why hex gets long.

Input
abc
Hex digests
MD5: 900150983cd24fb0d6963f7d28e17f72
SHA-1: a9993e364706816aba3e25717850c26c9cd0d89d
SHA-256: ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad
SHA-384: cb00753f45a35e8bb5a03d699ac65007272c32ab0eded1631a8b605a43ff5bed8086072ba1e7cc2358baeca134c825a7
SHA-512: ddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a2192992a274fc1a836ba3c23a3feebbd454d4423643ce80e2a9ac94fa54ca49f

Get a digest as Base64 instead of hex

The same 32 bytes written two ways: 64 hex characters or 44 Base64 characters. Base64 is the form a Content-Security-Policy hash source and a Subresource Integrity attribute expect; hex is what checksum files and shasum print.

Input
hello world
SHA-256
HEX: b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9
Base64: uU0nuZNNPgilLlLX2n2r+sSE7+N6U4DukIj3rOLvzek=

Sign a webhook payload with HMAC-SHA-256

With a key entered, the heading changes to All HMACs and every label gains the HMAC- prefix. The hex matches openssl dgst -sha256 -hmac whsec_9f2c over the same bytes, which is how a provider’s signature header is checked by hand.

Text, with the key whsec_9f2c
{"event":"invoice.paid","id":"in_1042"}
HMAC-SHA-256
HEX: c49ad655d978ac4f5de5c7e533a8191f7a4493d0fe4425178af970864bd5f068
Base64: xJrWVdl4rE9d5cflM6gZH3pEk9D+RCUXivlwhkvV8Gg=

Hash text outside ASCII

The counter reads 3 characters · 9 bytes: each of these characters is three bytes in UTF-8, and it is those nine bytes that are hashed. A tool that hashes UTF-16 or Latin-1 gives a different answer for the same text.

Input
日本語
MD5 and SHA-256
MD5: 00110af8b4393ef3f72c50be5b332bec
SHA-256: 77710aedc74ecfa33685e33a6c7df5cc83004da1bdcef7fb280f5c2b2e97e0a5

Supported formats

  • Any Unicode text as UTF-8Pasted or typed text, including line breaks and leading or trailing spaces, encoded as UTF-8 before hashing. The byte count under the box is the length the digest covers.
  • Five digest algorithmsMD5 (128-bit, RFC 1321), SHA-1 (160-bit) and SHA-256, SHA-384 and SHA-512 from the SHA-2 family of FIPS 180-4, computed together. SHA-1 is marked deprecated and SHA-256 recommended beside their results.
  • HMAC with a text keyHMAC-MD5, HMAC-SHA-1, HMAC-SHA-256, HMAC-SHA-384 and HMAC-SHA-512 per RFC 2104, with the key taken as UTF-8 text. A key longer than the hash’s block size is hashed first, as the RFC requires, and a shorter one is zero-padded.
  • Hex and Base64 outputEach digest as lowercase hexadecimal and as standard Base64 with = padding, not the URL-safe alphabet. Both have a copy button that confirms once the value is actually on the clipboard.

Use cases

  • Check a webhook or API signatureStripe, GitHub, Shopify and most payment providers sign a request body with HMAC-SHA-256 under a shared secret. Paste the raw body and the secret to see the expected value and compare it with the header the provider sent.
  • A CSP hash for an inline scriptPaste the exact contents of a script element, whitespace included, and take the SHA-256 Base64 value for a script-src source of the form sha256-… in single quotes, which lets that one inline block run under a strict Content-Security-Policy.
  • Confirm how a legacy system stores passwordsWhen a database column holds 32 hex characters, hash a known test account’s password here: a match proves it is unsalted MD5 and shows how urgently the scheme needs replacing. No match against any of the five suggests a salt or a proper password hash.
  • Deterministic keys and identifiersA SHA-256 of a canonical string makes a stable cache key, an ETag or a deduplication id that any language reproduces. Hash the string here to see the value a service should have produced when its cache misses look wrong.
  • Cross-check another implementationWhen a hashing routine in a new language or on an embedded device disagrees with the rest of a system, hash the same input here. A mismatch on non-ASCII text almost always means the other side is not encoding as UTF-8.

Limitations

  • Text only, not filesThe input is a text box, so the digest is of the characters you paste as UTF-8, not of a file’s bytes. To verify a download, hash the file itself: shasum -a 256 or sha256sum on macOS and Linux, certutil -hashfile or Get-FileHash on Windows.
  • Only the five algorithmsNo SHA-3, SHA-224, BLAKE2, BLAKE3, RIPEMD-160 or CRC32, and no truncated variants such as SHA-512/256. Web Crypto offers none of them, so the page does not either; openssl dgst -sha3-256 covers the first.
  • The key is text, not bytesAn HMAC key is read as UTF-8, so a secret stored as hex or Base64 cannot be entered as the bytes it encodes. Decode it first, or use openssl dgst -sha256 -mac HMAC -macopt hexkey:… for a raw key.
  • The exact box contents are hashedA trailing newline left by an editor, or added by echo on the command line, changes every digest. When a result here disagrees with a terminal, compare against printf or echo -n, and check for a byte order mark or Windows line endings.
  • No salts, iterations or key derivationThere is no PBKDF2, bcrypt, scrypt or Argon2 and no field for a salt, so these digests serve integrity checks and signatures, not stored password hashes. A password-hashing library in your own stack is the place for that.

Frequently asked questions

How do I generate an MD5 or SHA-256 hash of some text?

Type or paste the text into the input box. Every supported digest — MD5, SHA-1, SHA-256, SHA-384 and SHA-512 — is computed as you type and shown together, in hex and in Base64, so you do not have to pick an algorithm first or run the text through five separate tools.

Can a hash be reversed or decrypted?

No. Hashing is one-way by design: the digest is a fixed-length fingerprint, not an encrypted copy, and the original text cannot be recovered from it. What people call "decrypting" a hash is really looking it up in a table of pre-computed hashes of common inputs, which only works when the input was short or predictable.

Which should I use, SHA-256 or SHA-512?

SHA-256 for almost everything: it is the default across TLS certificates, Git object IDs, blockchain protocols and file checksums, and 256 bits is far beyond any feasible brute-force attack. SHA-512 is not meaningfully more secure in practice, though it is faster on 64-bit hardware, so it shows up where large volumes are hashed.

Are MD5 and SHA-1 still safe to use?

Not for anything security-critical. Both are broken against collision attacks — two different inputs can be engineered to produce the same digest — so neither should back a signature, a certificate or a tamper check. They are still perfectly useful as fast non-cryptographic checksums, for spotting an accidentally corrupted download or keying a cache.

What is an HMAC, and when should I use one instead of a plain hash?

An HMAC is a hash keyed with a secret, defined in RFC 2104: the key is mixed into the input twice, so only someone who holds it can produce or check the value. Use it to authenticate messages — webhook signatures, signed API requests, session cookies — where a plain hash would let anyone recompute the digest after altering the message. Enter a key above and every algorithm switches to its HMAC form, with the key read as UTF-8 text. HMAC-MD5 is included because legacy APIs still require it; new designs should use HMAC-SHA-256.

Can I use these hashes to store passwords?

No, and this is a common and costly mistake. MD5 and the SHA family are built to be fast, which is exactly wrong for passwords: a modern GPU tries billions of candidates a second against them. Use a deliberately slow password hash with a per-user salt — Argon2id, scrypt or bcrypt — which is what every current guideline calls for.

Why does the same text always give the same hash?

That is the point of a hash: it is deterministic, so the same input produces the same digest on any machine, in any language, forever. It is what lets you verify a download by comparing a checksum, and it is also why passwords need a random salt added before hashing — without one, identical passwords hash identically and stand out.

Is the text I hash uploaded anywhere?

No. The whole tool is JavaScript running in your own browser, so nothing you type or paste is sent over the network, written to a log or attached to an analytics event. You can confirm it by opening the network tab and watching it stay empty while you work.