About the Hash Generator
Use this SHA-256 hash generator to hash text or a file and get the MD5, SHA-1, SHA-384 and SHA-512 values next to it, computed in your browser as you type. Paste a checksum or a webhook signature into the compare box and it tells you which algorithm matches.
A hash is a fixed-length fingerprint of some bytes. The same input always gives the same hash, and one changed character gives a completely different one. Text is hashed as UTF-8. The SHA values come from your browser's Web Crypto API and MD5 from the crypto-js library, so nothing you type or drop here is uploaded.
- Paste the text you want to check into Text to hash. The five rows update a moment after you stop typing. With the box empty, they show the hashes of an empty string.
- To hash a file, drop it on the dashed area or click Choose file. Remove file brings the text box back.
- Need a signature rather than a plain hash? Put the secret in HMAC key (optional). The rows become HMAC-MD5, HMAC-SHA-256 and so on.
- Rows show lowercase hex. Turn on Uppercase for capital hex, or Base64 output for the Base64 form of the same bytes.
- Paste the value you want to check into Compare with a hash. The matching row turns green and the line under the field names it, for example Match: SHA-256. Spaces and a leading
sha256=orsha-256:are ignored. - Each row has its own copy icon, so you can grab just the SHA-256 or just the MD5.
InputhelloOutputMD5 5d41402abc4b2a76b9719d911017c592
SHA-1 aaf4c61ddcc5e8a2dabede0f3b482cd9aea9434d
SHA-256 2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824
SHA-384 59e1748777448c69de6b800d7a33bbfb9ff1b463e44354c3553bcdb9c666fa90125a3c79f90397bdf5f6a13de828684f
SHA-512 9b71d224bd62f3785d96d46ad3ea3d73319bfbc2890caadae2dff72519673ca72323c3d99ba5c11d7c7acc6e14b8c5da0c4663475c2e5c3adef46f73bcdec043Type Hello with a capital H and the SHA-256 becomes 185f8db32271fe25f561a6fc938b2e264306ec304eda518007d1764826381969. Nothing in it resembles the first one.
InputText to hash: {"event":"payment.succeeded","id":"evt_1042"}
HMAC key: my_webhook_secret
Compare with a hash: sha256=49818393455637497ac68a1f2135e86faed9b3b6674604188a4e56c7c1aa4d86OutputThe HMAC-SHA-256 row turns green.
Match: HMAC-SHA-256Add spaces after the colons and commas and the HMAC becomes ecc9babe1768b90c..., so you get No match with any hash above. Hash the raw body exactly as it arrived, never a pretty-printed copy.
InputText to hash: console.log("hello");
Base64 output: onOutputSHA-384 ym/3cF/gAcW1/eerNQGFaOSOuU2LHI6RYvChaVur/G+PkVozZ5Zo8Uu5R2S2zm7C
<script src="app.js"
integrity="sha384-ym/3cF/gAcW1/eerNQGFaOSOuU2LHI6RYvChaVur/G+PkVozZ5Zo8Uu5R2S2zm7C"
crossorigin="anonymous"></script>For a real script, drop the file. Most files end with a newline, and that byte changes the hash. To check an existing integrity value, paste the whole value into Compare with a hash; the sha384- prefix is removed for you.
How SHA-256 works
SHA-256 is part of the SHA-2 family, designed by the NSA and published by NIST in 2001 (the current standard is FIPS 180-4). The input is padded to a multiple of 512 bits, with its length stored at the end. Each 512-bit block then goes through 64 rounds that mix eight 32-bit values with rotations, additions and fixed constants. Those eight values after the last block are the hash: 32 bytes, shown as 64 hex or 44 Base64 characters.
Finding an input for a given hash would take about 2^256 attempts, and finding any two inputs with the same hash about 2^128. You'll meet SHA-256 in TLS certificates, Bitcoin block hashes, Docker image digests (sha256:...), the SHA256SUMS files next to Linux ISO downloads, and HMAC-signed webhooks and HS256 JWTs.
MD5, SHA-1, SHA-256, SHA-384 or SHA-512?
All five are here so you can match whatever a system hands you. For anything new, choose SHA-256.
- MD5: 32 hex characters. Collisions have been easy since 2004, and one was used to forge a CA certificate in 2008. Fine for spotting accidental corruption or as a cache key, never for security.
- SHA-1: 40 hex characters. A public collision was published in 2017. Don't use it for signatures or certificates.
- SHA-256: 64 hex characters. The usual pick for checksums, signatures and HMAC. No practical attack is known.
- SHA-384: SHA-512 with different starting values, cut to 96 hex characters. Used in Subresource Integrity and TLS suites like
TLS_AES_256_GCM_SHA384. - SHA-512: 128 hex characters, built on 64-bit words and 80 rounds. On 64-bit processors without SHA-256 hardware support it's often faster than SHA-256 for long input.
Why your hash doesn't match another tool
When two tools disagree, they were given different bytes. Check these first:
- A hidden newline.
echo hello | sha256sumhasheshelloplus a line break and prints5891b5b5.... Useprintf '%s' helloorecho -n. - Windows line endings.
hellofollowed by CR and LF hashes tocd2eca35..., so the same file can hash differently on Windows and Linux. - Unicode normalization.
caféwritten with oneécharacter, or witheplus a combining accent, looks the same but hashes to850f7dc4...or81ef060b.... - Hex pasted as text. The text box hashes characters, so
48656c6c6fis hashed as 10 characters (d8e0f838...), not as the 5 bytes ofHello. To hash raw bytes, save them to a file and drop it. - UTF-16. .NET code using
Encoding.Unicodehashes different bytes than this page, which always uses UTF-8.
HMAC and webhook signatures
Anyone can hash a message, so a plain hash proves nothing about who sent it. HMAC (RFC 2104) mixes a secret key into the hash, and only someone with the key can produce the same value. Webhook providers use it with different header formats:
- GitHub:
X-Hub-Signature-256: sha256=<hex>over the raw body. Paste the whole value, prefix included. - Stripe:
Stripe-Signature: t=<timestamp>,v1=<hex>. The signed text is the timestamp, a dot, then the body. Hash that joined string and paste thev1=…part; the prefix is removed for you. - Shopify: Base64 HMAC-SHA256 in
X-Shopify-Hmac-Sha256. Paste it as it is.
Checking signatures in your own code
Don't build a MAC as sha256(secret + message): SHA-256 allows length extension attacks on that construction, which is the problem HMAC solves. And compare signatures with a constant-time function such as crypto.timingSafeEqual (Node.js) or hmac.compare_digest (Python). A normal string comparison stops at the first wrong byte, and that timing can leak the right signature.
Verify a file checksum from the command line
On a server, or for files of several gigabytes, use the built-in commands:
sha256sum file.iso
# check every file listed in a checksum file:
sha256sum -c SHA256SUMSshasum -a 256 file.isoGet-FileHash .\file.iso -Algorithm SHA256certutil -hashfile file.iso SHA256SHA-256 and HMAC in code
Each snippet hashes the UTF-8 text hello, and the HMAC lines use the key secret.
const data = new TextEncoder().encode("hello");
const hash = await crypto.subtle.digest("SHA-256", data);
const hex = Array.from(new Uint8Array(hash), (b) => b.toString(16).padStart(2, "0")).join("");
// '2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824'import { createHash, createHmac } from "node:crypto";
createHash("sha256").update("hello").digest("hex");
// '2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824'
createHmac("sha256", "secret").update("hello").digest("hex");
// '88aab3ede8d3adf94d26ab90d3bafd4a2083070c3bcce9c014ee04a443847c0b'import hashlib, hmac
hashlib.sha256("hello".encode()).hexdigest()
hmac.new(b"secret", b"hello", hashlib.sha256).hexdigest()sum := sha256.Sum256([]byte("hello"))
fmt.Println(hex.EncodeToString(sum[:]))byte[] hash = MessageDigest.getInstance("SHA-256")
.digest("hello".getBytes(StandardCharsets.UTF_8));
String hex = HexFormat.of().formatHex(hash); // Java 17+Convert.ToHexString(SHA256.HashData(Encoding.UTF8.GetBytes("hello"))); // .NET 5+, uppercase hexhash("sha256", "hello");
hash_hmac("sha256", "hello", "secret");printf '%s' 'hello' | sha256sum # Linux
printf '%s' 'hello' | shasum -a 256 # macOSCan a SHA-256 hash be decrypted?
No. Hashing isn't encryption: there's no key, and the output is far smaller than most inputs, so the original can't be rebuilt. Sites that claim to reverse SHA-256 look the hash up in tables of common words and leaked passwords. If you need the data back later, encrypt it with AES instead.
Can two different inputs have the same SHA-256 hash?
In theory, yes: there are endless possible inputs and only 2^256 possible hashes. In practice nobody has ever found such a pair, and a search would take around 2^128 attempts.
Should I hash passwords with SHA-256?
No. SHA-256 is fast, so one modern GPU can test billions of guesses per second against a leaked hash, salted or not. Store passwords with Argon2id, scrypt or bcrypt, which are slow on purpose. For new random passwords, use the Password Generator.
What's the difference between SHA-256 and SHA-512?
SHA-256 gives 32 bytes from 32-bit words and 64 rounds. SHA-512 gives 64 bytes from 64-bit words and 80 rounds. Both are secure, so use whichever the other system expects, and SHA-256 when you're free to choose.
Why is my SHA-256 different from sha256sum?
echo adds a newline. echo 'hello' | sha256sum prints 5891b5b522d5df086d0ff0b110fbd9d21bb4fc7163af34d08286a2e846f6be03, while printf '%s' hello | sha256sum prints the 2cf24dba... value shown here.
What is the SHA-256 hash of an empty string?
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855. If it shows up in your logs, something hashed an empty value, often a request body that was never read.
Is it safe to enter a webhook secret or drop a private file?
The HMAC key, the text and any file you drop are processed by your browser and aren't sent to a server. The whole file is read into memory, though, so for files of several gigabytes the command line is the better choice.