SHA-256 Generator
Compute SHA-256 hashes. 256-bit output in hex and Base64.
Free online hash generator supporting MD5, SHA-1, SHA-256, SHA-384, and SHA-512. Switch algorithms instantly. HMAC support for SHA algorithms. Output in hex and Base64.
Algorithm
A cryptographic hash function takes an input of any length and returns a fixed size string of bytes, called a digest or a hash. The transformation is designed to be a one way street: computing the digest from the message is trivial, and recovering the message from the digest is meant to be impossible in any practical sense. Every algorithm in this tool, MD5, SHA-1, SHA-256, SHA-384, and SHA-512, is built on that same promise, and they differ mainly in how well the promise still holds.
Five properties define what a cryptographic hash is supposed to deliver. It must be deterministic, so the same input always yields the same digest on every machine and in every implementation. It must produce a fixed output size, so a one byte file and a ten gigabyte file both hash to the same number of characters. It must exhibit the avalanche effect, so that flipping a single input bit changes roughly half the output bits with no discernible pattern. It must be preimage resistant, meaning that given a digest there is no feasible way to find any message producing it. And it must be collision resistant, meaning nobody can find two distinct messages sharing a digest.
Collisions certainly exist. There are infinitely many possible inputs and only 2^256 possible SHA-256 outputs, so by the pigeonhole principle countless messages share every digest. Security rests entirely on nobody being able to find such a pair. That is exactly where MD5 and SHA-1 failed while SHA-2 continues to hold.
Mechanically, every algorithm here uses the Merkle-Damgard construction. The message is padded to a whole number of blocks, with the final block carrying an encoding of the original message length. An internal state is initialized to fixed constants, then a compression function absorbs one block at a time, mixing the block into the state through a series of rounds built from rotations, XORs, modular additions, and small nonlinear boolean functions. When the last block has been absorbed, the state is serialized and printed as hexadecimal.
The differences between the algorithms are entirely in those parameters. MD5 keeps a 128-bit state and runs 64 operations over 512-bit blocks. SHA-1 widens the state to 160 bits and the schedule to 80 rounds. SHA-256 moves to eight 32-bit words and 64 rounds with a much stronger message schedule. SHA-512 doubles everything to 64-bit words and 1024-bit blocks over 80 rounds, which is why it is often faster than SHA-256 on 64-bit hardware despite the larger output. SHA-384 is SHA-512 with different initial values and a truncated result.
One shared consequence of the Merkle-Damgard design is length extension: given the digest of an unknown message and its length, an attacker can compute the digest of that message with a suffix appended, without knowing the original. This affects all five algorithms and is the reason you should never authenticate data by hashing a secret concatenated with it.
Every algorithm this tool supports, side by side. Output length is the quickest practical way to identify an unknown digest.
| Algorithm | Output bits | Hex length | Status |
|---|---|---|---|
| MD5 | 128 | 32 | Broken, non-security use only |
| SHA-1 | 160 | 40 | Broken, deprecated |
| SHA-256 | 256 | 64 | Secure |
| SHA-384 | 384 | 96 | Secure |
| SHA-512 | 512 | 128 | Secure |
Broken here means specifically that collision resistance has fallen. Both MD5 and SHA-1 still resist preimage attacks, which is why they remain marginally usable as non adversarial checksums. That is a narrow exemption, not a defence.
The word hello, hashed with three different algorithms. Nothing about the input changes, only the algorithm, and the results are unrelated strings of very different lengths.
Enter hello in the generator above and switch algorithms to reproduce all three. Then change the input to Hello, capital H, one bit of difference. Every digest changes completely, and none of them resembles its previous value. That is the avalanche effect at work, and it is what lets a digest act as a tamper evident seal: there is no way to make a small controlled change to the output by making a small change to the input.
Most of the decision comes down to one question: does an attacker gain anything by finding two inputs with the same digest? If yes, you need SHA-2. If no, almost anything works and speed can decide.
A useful summary: use SHA-256 unless you have a specific reason not to, use SHA-512 when throughput on 64-bit hardware matters, use HMAC when a secret is involved, use a real KDF for passwords, and treat MD5 and SHA-1 as read only formats you interoperate with rather than choices you make.
This applies to every algorithm on this page, the broken ones and the secure ones alike, and the reason is the same in each case. General purpose hash functions are optimized for speed. Their intended job is to fingerprint large files at close to memory bandwidth, and both hardware and implementations have been tuned relentlessly toward that goal. Speed is the correct property there and exactly the wrong property for a password.
When a password database leaks, the attacker does not attack the mathematics. They guess. They take a wordlist, apply mangling rules, hash each candidate, and look for matches. Their success is determined purely by how many guesses per second the hardware allows, and with a general purpose hash the answer is billions on a single GPU. Since real password choices cluster heavily around a relatively small set of patterns, a large fraction of any leaked table falls within hours.
Salting is the first requirement and is not optional. Generate at least 16 random bytes per user, store them in plain text beside the hash, and include them in the hashed input. This ensures two users with the same password get different digests, so an attacker cannot crack the table in one pass, and it makes precomputed rainbow tables useless. What salting cannot do is make any single guess more expensive.
Making guesses expensive is the job of a password hashing function, and there are three worth using. Argon2id is the current recommendation from OWASP and the winner of the Password Hashing Competition. It is memory hard, requiring a configurable amount of RAM for every evaluation, which is what defeats GPU and ASIC attacks, because memory bandwidth is far harder to parallelize than raw arithmetic. scrypt is older and also memory hard. bcrypt is not memory hard but has an adjustable work factor, thirty years of scrutiny, and support in essentially every language. Where policy requires a FIPS approved primitive, PBKDF2-HMAC-SHA256 with a high iteration count is acceptable, and it is the one legitimate place a SHA-2 function belongs in a password pipeline.
Tune whichever you pick so a single hash takes roughly 100 to 500 milliseconds on your production hardware. A user logging in will never notice. An attacker running a wordlist will never finish.
A plain hash proves that data has not changed, but it proves nothing about who produced it, because anyone can recompute a digest after modifying the message. HMAC solves that by mixing a secret key into the hashing process. Defined in RFC 2104, it hashes the message twice: the key is XORed with an inner padding constant and prepended for the first pass, then XORed with an outer padding constant and prepended to that result for the second. The nested structure is deliberate, and it is what makes HMAC immune to the length extension problem that all Merkle-Damgard hashes share.
The result authenticates as well as verifies. A valid HMAC tag means both that the message arrived unaltered and that it was produced by someone holding the shared secret. That is a materially stronger claim than a bare checksum, and it is the guarantee that most API security actually rests on.
The uses are everywhere. JWTs signed with HS256, HS384, or HS512 are HMAC over the token header and payload. AWS Signature Version 4 derives a request specific key through a chain of HMAC-SHA256 operations. Webhook providers including Stripe, GitHub, and Shopify sign their payloads so receivers can confirm the callback is genuine. Web frameworks use HMAC for signed cookies and CSRF tokens, and TLS 1.3 uses it inside HKDF for key derivation.
Two rules when implementing. Always compare tags with a constant time comparison, never with ordinary string equality, since a normal comparison exits at the first mismatched byte and that timing difference is enough to forge a tag byte by byte. And prefer HMAC-SHA256 or better, since HMAC-SHA1 and HMAC-MD5 are not currently broken but have no reason to exist in new code. The generator above supports HMAC mode with your own secret key.
Each algorithm also has its own dedicated page, linked from the tools directory along with a JWT decoder for inspecting HMAC signed tokens and Base64, hex, and URL encoding utilities for the formats digests are usually carried in.
Cryptographic hash functions take an input of any length and produce a fixed-length output called a digest or hash. Three properties make them useful in security: preimage resistance (cannot find the input from the hash), second preimage resistance (cannot find a different input with the same hash as a known input), and collision resistance (cannot find any two inputs with the same hash). These properties underpin digital signatures, certificate authorities, password storage systems, and blockchain technology. This tool computes all five algorithms in your browser using the SubtleCrypto API, which is implemented in native code and provides both speed and privacy.