sha256 hash generator online
RecommendedCreate the sha256 hash of any text: 64 hex characters, the same result as PHP's hash(). Check a hash or a file below. Nothing leaves your browser.
Compare, hash a file, copy any format
Type text in the tool above or choose a file. Case, spaces and prefixes like sha256: don't matter.
hello world- Hex
b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9- HEX (upper case)
B94D27B9934D3E08A52E52D7DA7DABFAC484EFE37A5380EE9088F7ACE2EFCDE9- Base64
uU0nuZNNPgilLlLX2n2r+sSE7+N6U4DukIj3rOLvzek=- SRI (integrity attribute)
sha256-uU0nuZNNPgilLlLX2n2r+sSE7+N6U4DukIj3rOLvzek=
Files are read in your browser and never uploaded.
What is SHA-256?
SHA-256 is the most widely used member of the SHA-2 family: it turns any input into a 256-bit hash, written as 64 hex characters. It secures TLS certificates, software downloads, Bitcoin and JSON Web Tokens (as HMAC-SHA256). No practical attack is known.
- Checksums of downloads
- TLS certificates and code signing
- Bitcoin (double SHA-256)
- HMAC-SHA256 for APIs and JWT (HS256)
Change one letter, see what happens
A cryptographic hash changes about half of all bits when one input character changes. Nothing about the old hash tells you what the new one will be.
……Calculating…
How SHA-256 works, round by round
Every SHA-256 hash is made in the same four stages. The map shows them for the example abc: click a stage to see what it does and why. Below the map you can watch each stage with your own text, down to every single round. The last line must match the tool at the top.
SHA-256 works on bytes, not letters. Your text is turned into UTF-8 bytes first: abc becomes 61 62 63. Every character counts, including spaces and line breaks, which is why a stray newline gives a different hash.
The algorithm only takes whole blocks of exactly 64 bytes. So the message gets an end marker (80), zeros, and in the last 8 bytes its own length. Short texts fit in one block, longer ones are split into several, and each block runs through steps 2 and 3.
A block is 16 words of 4 bytes, but SHA-256 has 64 rounds and uses one word per round. So it stretches the 16 words to 64: each new word is mixed from four earlier ones. This spreads every input bit over many rounds.
Eight registers a to h (32 bits each) start with fixed values. Each round stirs in one word from step 2 and one constant. Only a and e get new values, the other six move one place along. After 64 rounds every input bit has influenced every register.
The registers are added to their start values. With several blocks, this becomes the start for the next block. After the last block the eight registers side by side, 8 × 8 hex characters, are the 64-character hash.
Your text
1 · Padding: fill up to whole 64-byte blocks
SHA-256 can only process blocks of exactly 64 bytes. So it appends the byte 80 as an end marker, then zeros, and finally the message length in bits as an 8-byte number. The length at the end makes sure that two different messages never look the same after padding.
your message80 = end markerzeroslength in bits
Block
Your message needs more than one block. Steps 2 and 3 run once per block; pick one to look at.
2 · Message schedule: stretch 16 words to 64
The block is cut into 16 words of 4 bytes each, W0–W15 (blue). The compression in step 3 runs 64 rounds and needs one word per round, so SHA-256 computes 48 more words, W16–W63. Each one mixes four earlier words:
W[t] = σ1(W[t−2]) + W[t−7] + σ0(W[t−15]) + W[t−16]
σ0 and σ1 rotate and shift the bits of a word (σ0: rotate by 7 and 18, shift by 3; σ1: rotate by 17 and 19, shift by 10) and combine the results with XOR. That way a change anywhere in the block spreads into many later words. Click any word to see where it comes from; its round opens in step 3.
3 · Compression: 64 rounds of mixing
The working state is eight registers a to h of 32 bits. For the first block they start with fixed values from the standard (the first 32 bits of the fractional parts of the square roots of the first 8 primes). Each round takes one word W[t] from step 2 and one round constant K[t], computes two helper values T1 and T2, and from them new values for a and e (yellow). The other six registers move one place along. Use the slider or the arrows to go through the rounds.
Σ1(e), Σ0(a): the register rotated three ways and combined with XOR · Ch(e,f,g) “choose”: where e has a 1 take the bit of f, else of g · Maj(a,b,c) “majority”: the bit that at least two of a, b, c have · K[t]: 64 fixed constants (fractional parts of the cube roots of the first 64 primes).
4 · Result: add up and write side by side
After round 64 the registers are added to the values they started the block with. With more blocks, the sum is the start for the next block. After the last block, the eight registers written side by side (8 × 8 hex characters) are the hash.
ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015adIs it a common password?
No one can decrypt a hash. What "decrypt" sites do is compare it with hashes of known words. This check does the same in your browser with about 11,000 common passwords, PINs and years, so you can see how quickly weak passwords fall.
Nothing is sent anywhere. The list is part of this page.
Free course: why hashes can’t be decrypted, and how to store passwords →
The same result in your code
Every snippet prints b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9 for hello world, the same as the tool. They are run against PHP's hash() before each release.
echo hash('sha256', 'hello world');
import hashlib print(hashlib.sha256("hello world".encode()).hexdigest())
import { createHash } from "node:crypto"; console.log(createHash("sha256").update("hello world").digest("hex"));
const data = new TextEncoder().encode("hello world"); const buf = await crypto.subtle.digest("SHA-256", data); console.log([...new Uint8Array(buf)].map((b) => b.toString(16).padStart(2, "0")).join(""));
import java.nio.charset.StandardCharsets; import java.security.MessageDigest; import java.util.HexFormat; public class Hash { public static void main(String[] args) throws Exception { byte[] digest = MessageDigest.getInstance("SHA-256") .digest("hello world".getBytes(StandardCharsets.UTF_8)); System.out.println(HexFormat.of().formatHex(digest)); // Java 17+ } }
package main import ( "fmt" "crypto/sha256" ) func main() { fmt.Printf("%x\n", sha256.Sum256([]byte("hello world"))) }
printf '%s' 'hello world' | sha256sum # macOS: printf '%s' 'hello world' | shasum -a 256 # File on Windows: certutil -hashfile file.zip SHA256
SHA-256 test values
Hashes of common test strings (UTF-8, no line break). Use them to check your own implementation.
| Input | sha256 |
|---|---|
| empty string | e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 |
abc | ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad |
hello world | b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9 |
The quick brown fox jumps over the lazy dog | d7a8fbb307d7809469ca9abcb0082e4f8d5651e46d3cdb762d02d0bf37c9e592 |
SHA-256 hashes of the 5 most common passwords
These five lead the public lists of leaked passwords year after year, so their hashes are in every cracking list too. If you see one of these values in a database, the password is known. Paste one into the password check above to see it found in a split second.
| Password | sha256 |
|---|---|
123456 | 8d969eef6ecad3c29a3a629280e686cf0c3f5d5a86aff3ca12020c923adc6c92 |
password | 5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8 |
123456789 | 15e2b0d3c33891ebb0f1ef609ec419420c20e320ce94c65fbc8c3312448eb225 |
12345678 | ef797c8118f02dfb649607dd5d3f8c7623048c9c063d532cc95c5ed7a898a64f |
12345 | 5994471abb01112afcc18159f6cc74b4f511b99806da59b3caf5a9c173cacfc5 |
Why your SHA-256 doesn't match
With SHA-256, SHA-512, SHA-1 and MD5, hash(secret + message) is not a safe signature: an attacker can append data and compute a valid hash without the secret. Use HMAC.
A fast hash lets attackers try billions of guesses per second. Store passwords with Argon2id, bcrypt or scrypt, which are slow on purpose and use a salt.
echo "hello world" | sha256sum hashes 12 bytes: the text plus a line break. Use printf '%s' 'hello world' or echo -n to hash exactly 11 bytes.
The tool hashes UTF-8 bytes, like most languages. Windows APIs and .NET's Encoding.Unicode use UTF-16, older systems Latin-1. "ü" is 2 bytes in UTF-8, 1 in Latin-1, 2 in UTF-16, and each gives a different hash.
Hex is not case-sensitive: 5EB63BBB… and 5eb63bbb… are the same hash. Compare in one case, and watch for spaces or a prefix like "sha256:".
Like the form on the original site, the tool removes spaces and line breaks at the start and end and sends line breaks as CRLF (\r\n). For exact bytes use "Hash a file" or "Exactly as typed" in the check panel.
The SHA-2 family side by side
The same text, every SHA-2 algorithm. Shown for hello world; type in the tool above to use your text.
| Algorithm | Hash | Bits |
|---|---|---|
| sha224 | 2f05477fc24bb4faefd86517156dafdecec45b8ad3cf2522a563582b | 224 |
| sha256 | b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9 | 256 |
| sha384 | fdbd8e75a67f29f701a4e040385e2e23986303ea10239211af907fcbb83578b3e417cb71ce646efd0819dd8c088de1bd | 384 |
| sha512/224 | 22e0d52336f64a998085078b05a6e37b26f8120f43bf4db4c43a64ee | 224 |
| sha512/256 | 0ac561fac838104e3f2e4ad107b4bee3e938bf15f2b15f009ccccd61a913f017 | 256 |
| sha512 | 309ecc489c12d6eb4cc40f50c902f2b4d0ed77ee511a7c7a9bcd3ca86d4cd86f989dd35bc5ff499670da34255b45b0cfd830e81f605dcf7dc5542e93ae9cd76f | 512 |
How fast is SHA-256?
Hashes up to 4 MB of random data in your browser and compares with md5, sha512, xxh3. Browser numbers are lower than native code, but the ranking holds.
Questions about SHA-256
Can SHA-256 be decrypted?
No. SHA-256 is a one-way function: there is no key and no way to compute the input from the hash. Sites that "decrypt" SHA-256 look the hash up in large tables of known inputs, which only works for short or common strings.
How long is a SHA-256 hash?
A SHA-256 hash is always 256 bits, written as 64 hexadecimal characters (32 bytes), no matter how long the input is.
Is SHA-256 secure?
Yes. No practical attack on SHA-256 is known, and it is approved for integrity checks and signatures. For passwords use a slow password hash instead.
Should I hash passwords with SHA-256?
No. SHA-256 is fast, so attackers can test huge numbers of guesses. Use Argon2id, bcrypt or scrypt with a unique salt per password.
Is SHA-256 the same as SHA-2?
SHA-2 is the family; SHA-256 is its most used member. The family also includes SHA-224, SHA-384, SHA-512, SHA-512/224 and SHA-512/256.
Is SHA-256 the same as SHA3-256?
No. Both give 256 bits, but SHA3-256 is based on Keccak and gives completely different results.
What is the difference between SHA-256 and HMAC-SHA256?
HMAC-SHA256 mixes a secret key into SHA-256, so only someone with the key can create or check the value. Plain SHA-256 needs no key: anyone can compute it. Neither can be decrypted. Webhook signatures from GitHub, Stripe or Shopify and JWTs signed with HS256 are HMAC-SHA256.