A software download page lists a long string labelled "SHA-256" next to the file. An API asks you to send a hash of the request body. A database migration stores a fingerprint of each script so it can tell whether one was changed. All of these rely on the same idea: a cryptographic hash function that turns any input into a short, fixed-length fingerprint.
This guide explains what a hash is and what it is not, compares the SHA family, shows how to create a hash from text in a browser and how to check a file's checksum on Windows, macOS and Linux, and covers the reasons two hashes of "the same" text often do not match.
What a hash function does
A cryptographic hash function takes input of any length and produces a fixed-length output called a digest. SHA-256, for example, always produces 256 bits, usually shown as 64 hexadecimal characters:
Input: hello
SHA-256: 2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824
Good hash functions have four properties that make them useful:
- Deterministic. The same input always gives the same digest, on any computer.
- Avalanche effect. Changing a single character, even the case of one letter, produces a completely different digest.
Hellohashes to185f8db3…, with no visible relationship to the hash ofhello. - One-way. You cannot work backwards from a digest to the input, except by guessing inputs and hashing them.
- Collision resistant. It should be infeasible to find two different inputs with the same digest.
A hash is not encryption. There is no key and no way to "decrypt" a digest. It is also not encoding: Base64 can be reversed, a hash cannot.
SHA-1, SHA-256, SHA-384 and SHA-512 compared
| Algorithm | Digest length | Hex characters | Status |
|---|---|---|---|
| SHA-1 | 160 bits | 40 | Broken for collision resistance; avoid for security |
| SHA-256 | 256 bits | 64 | Widely used default |
| SHA-384 | 384 bits | 96 | SHA-2 family; a shortened SHA-512 variant |
| SHA-512 | 512 bits | 128 | SHA-2 family; often faster on 64-bit CPUs |
SHA-1 is still seen in older systems and in Git's object IDs, but practical collision attacks have been demonstrated, so it should not be used where an attacker could craft inputs. MD5 is weaker still. For new work, SHA-256 is the sensible default. SHA-3 is a newer, differently designed family, but SHA-2 remains unbroken and is far more widely supported.
Generate hashes from text in your browser
The Hash Generator uses the Web Crypto API built into your browser, so the text you enter is never uploaded.
- Open the Hash Generator and type or paste into Input Text.
- Click Generate Hashes.
- The tool shows the SHA-1, SHA-256, SHA-384 and SHA-512 digests of the text, each as lowercase hexadecimal.
- Click the copy icon next to the digest you need.
The text is encoded as UTF-8 before hashing, which matches what most programming languages and command-line tools do by default. The tool hashes typed or pasted text only; it does not read files, and it does not offer MD5. To check a downloaded file, use the command-line methods below, which read the file directly and handle files of any size.
If you need a keyed hash, where only someone with a shared secret can produce the right value (as used for webhook signatures), that is an HMAC. Use the HMAC Generator. For a fast, non-cryptographic checksum used by ZIP files and network protocols, see the CRC32 Checksum tool.
Checking a file's checksum
When a download page publishes a SHA-256 value, you hash the file you received and compare. If even one byte was corrupted or altered, the digests will not match.
Windows (PowerShell)
Get-FileHash .\installer.exe -Algorithm SHA256
The older certutil -hashfile installer.exe SHA256 command also works in Command Prompt.
macOS
shasum -a 256 installer.dmg
Linux
sha256sum installer.tar.gz
sha256sum -c checksums.txt # verify every file listed in a checksum file
Compare the full digest, not just the first few characters, and ignore case: Get-FileHash prints uppercase, most other tools print lowercase, and both are the same value.
A matching checksum proves the file is identical to the one the hash was computed from. It only proves the file is genuine if you obtained the hash from a source you trust, ideally over HTTPS from the publisher's own site. Signed releases give stronger guarantees than checksums alone.
Why hashes of "the same" text differ
This is the most common complaint about hash tools. The digest depends on every byte, including ones you cannot see.
A hidden newline
echo "hello" | sha256sum hashes hello plus a newline character, giving 5891b5b5… instead of 2cf24dba…. Use printf 'hello' or echo -n "hello" to hash only the visible text. Text copied from an editor may also carry a trailing newline.
Line endings
Windows files often use CRLF line endings and Unix files use LF. A text file with identical visible content but different line endings has a different hash.
Character encoding
café in UTF-8 and café in Windows-1252 are different byte sequences. Hash tools that encode text differently will disagree. When comparing with code, make sure both sides use UTF-8.
Whitespace and formatting
Hashing a JSON object after pretty-printing gives a different result from hashing the minified version. If you sign or fingerprint structured data, agree on an exact serialisation first.
Hashes and passwords: use the right tool
A fast hash like SHA-256 is the wrong way to store passwords. Its speed is exactly what an attacker wants: modern hardware can test enormous numbers of guesses per second against a leaked SHA-256 hash, and common passwords can be found almost instantly using precomputed tables.
Password storage needs a deliberately slow, salted algorithm such as bcrypt, scrypt or Argon2. The Bcrypt Generator lets you create and check bcrypt hashes for testing. Use SHA-256 for fingerprints, integrity checks and deduplication, not for credentials.
Frequently asked questions
Can a SHA-256 hash be decrypted?
No. Hashing is one-way. Sites that claim to "decrypt" hashes simply look them up in lists of previously hashed common inputs, which is why short or common inputs are not protected by hashing alone.
Is SHA-256 the same as a checksum?
A SHA-256 digest can be used as a checksum. "Checksum" is the general term for any value used to detect changes; CRC32 is a simpler, non-cryptographic example.
Why does my hash not match the one on the website?
Check that you hashed the right file with the right algorithm, that the download completed, and that you are comparing full values. For text, check for hidden newlines, line endings and encoding differences.
Is SHA-512 more secure than SHA-256?
Both are currently considered secure. SHA-512 has a longer output and can be faster on 64-bit machines, but SHA-256 is more than enough for integrity checks and is supported everywhere.
Why is there no MD5 option?
The browser's Web Crypto API, which this tool uses, does not include MD5 because it is considered broken. Use SHA-256 unless an old system specifically requires MD5.