SHA hash generator
- Runs in your browser
- No signup
- Formula shown below
- Reviewed
A cryptographic hash maps input of any length to a fixed-length digest. SHA-256 always produces 256 bits, written as 64 hexadecimal characters, and the SHA-256 digest of "abc" is ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad. Changing one input bit changes roughly half the output bits, an effect known as the avalanche property.
How to generate a hash
- 01
Choose an algorithm
Select SHA-256 for general use, SHA-512 for a wider digest, or SHA-1 only when checking a legacy checksum.
- 02
Enter text or pick a file
Type into the text pane, or choose a file to hash its raw bytes instead. Digests update as you type.
- 03
Read the digest
The full lowercase hexadecimal digest appears in the result strip, alongside its width in bits.
- 04
Copy and compare
Copy the digest and compare it against a published checksum. Any single character differing means the data differs.
The formula
digest = SHA-n(message); |digest| = n bits = n ÷ 4 hex characters
- message
- The input, of any length, hashed as UTF-8 bytes for text or as raw bytes for a file.
- n
- The digest width in bits — 160 for SHA-1, 256, 384 or 512 for the SHA-2 family.
- digest
- The fixed-length output, rendered here as lowercase hexadecimal.
- avalanche
- The property that a one-bit input change flips about half the output bits, making digests uncorrelated.
Hashing is one-way and deterministic: the same input always gives the same digest, and no operation recovers the input from it. That is what makes a digest useful for verifying that a download arrived intact, and it is also why a hash alone is the wrong way to store passwords, which need a slow, salted function such as Argon2 or bcrypt instead.
Worked example
- Input
- abc
- Algorithm
- SHA-256
- Result
- ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad
The 3-byte input "abc" is padded and processed through 64 rounds of the SHA-256 compression function, producing 256 bits of output written as 64 hexadecimal characters. This value is the published test vector in FIPS 180-4, so it can be checked against the standard itself. Changing the input to "abd" produces a completely unrelated digest with roughly 128 of the 256 bits flipped, despite differing by a single bit of input.
Frequently asked questions
What is a cryptographic hash function?
A cryptographic hash maps input of any size to a fixed-size digest with three properties: it is infeasible to recover the input from the digest, infeasible to find a second input with the same digest, and infeasible to find any two inputs that collide. Those properties make digests usable as compact, verifiable fingerprints of data.
Which hash algorithm should be used?
SHA-256 is the current default for integrity checking, digital signatures and certificate fingerprints. SHA-512 offers a wider digest and is actually faster on 64-bit hardware. SHA-384 appears in TLS cipher suites. SHA-1 is broken for security purposes and should be used only to verify a legacy checksum that already exists.
Why is SHA-1 considered broken?
The SHAttered research published in 2017 produced two different PDF files with an identical SHA-1 digest, demonstrating a practical collision. Cost has fallen sharply since. A collision means an attacker can substitute one document for another while the checksum still matches, which defeats the entire purpose of the digest for security use.
Can a hash be reversed to recover the original text?
Not by computation. Hashing destroys information — any length of input maps to a fixed output — so there is nothing to invert. Short or common inputs can still be found by brute force or rainbow table, which is why the digest of a common password reveals it instantly. Salting defeats precomputed tables.
Should passwords be stored as SHA-256 hashes?
No. SHA-256 is designed to be fast, and modern hardware computes billions of digests per second, so a stolen database of SHA-256 password hashes falls quickly to brute force. Password storage needs a deliberately slow, salted, memory-hard function — Argon2id is the current recommendation, with bcrypt and scrypt acceptable alternatives.
How do you verify a downloaded file with a checksum?
Choose the file here, select the algorithm the publisher used, and compare the resulting digest character by character against the published value. An exact match confirms the file arrived intact and unmodified. Any difference at all means the file is corrupt or has been tampered with, and it should not be run.
Is the text or file uploaded to generate a hash?
No. Hashing uses the Web Crypto API's digest function, implemented natively in the browser and executed in this page. A file is read from local disk into memory and hashed there. Nothing is transmitted, and this site has no server-side code capable of receiving data, so hashing a private document is safe.
Sources
- FIPS 180-4 — Secure Hash Standard — US National Institute of Standards and Technology
- SHAttered — the first practical SHA-1 collision — CWI Amsterdam and Google Research
- Password Storage Cheat Sheet — OWASP
Last reviewed: · Formula and sources verified by Syed Aqeel Ahmad Gillani. See the methodology for how every calculation is derived.