PRACTICAL GUIDE
What Is a SHA-256 Hash, and What Is It Actually For?
Hashes fingerprint data: same input, same output, and no way back. Where that is useful, where it is misused, and how to check a downloaded file.
Last updated
A fingerprint, not a container
A cryptographic hash function takes input of any length and produces a fixed-length value — 256 bits for SHA-256, written as 64 hexadecimal characters. The same input always yields the same output, and the output reveals nothing useful about the input.
It is a one-way operation. There is no decode step, no key, and nothing to reverse. A hash of a one-terabyte file and a hash of the word 'hello' are both 64 characters, which should make it obvious that the original data cannot be inside the result.
The avalanche property is the point
Change a single character of the input — a comma, a space, one bit in a multi-gigabyte archive — and the output changes completely and unpredictably. Two nearly identical documents produce two hashes with no visible relationship. This is what makes a hash useful for detecting tampering: there is no way to make a small edit that leaves a small trace.
What hashes are legitimately used for
Verifying downloads. A project publishes the SHA-256 of its installer; you hash the file you received and compare. If the values match, you have the bytes the publisher intended.
Detecting change. Comparing hashes tells you whether two files, records or backups are identical without transmitting or reading them.
Deduplication and caching, where a hash serves as a compact identity for a piece of content.
Digital signatures, where the hash of a document is what actually gets signed, because signing a short fixed-length value is far cheaper than signing the whole thing.
The big misuse: storing passwords
A plain SHA-256 is the wrong tool for password storage, and its greatest strength is why. It is designed to be fast, so an attacker who obtains your database can try billions of candidate passwords per second against it.
Password storage needs a deliberately slow, salted algorithm — bcrypt, scrypt or Argon2 — with a work factor you can raise as hardware improves. If you are reaching for SHA-256 to hash a password, reach for one of those instead.
What about MD5 and SHA-1
Both are broken for security purposes: it is practical to construct two different inputs that share a hash, which destroys any guarantee that a matching value means matching content. They survive in the wild as quick non-adversarial checks — an integrity check against accidental corruption — but they must not be used where someone might be trying to fool you. SHA-256 is the sensible default today.
Hashing text here, hashing files on your machine
Our generator hashes text you type or paste, using the Web Crypto API in your own browser. That covers the common cases of hashing a string, an identifier or a short document, and the text never leaves your device.
For a file, the fastest route is your own terminal, which also avoids loading a large file into a browser tab. On macOS or Linux run: shasum -a 256 filename. On Windows, in Command Prompt: certutil -hashfile filename SHA256. Compare the result against the value the publisher gives you — the whole string, not just the first few characters.
Frequently asked questions
Can a hash be decrypted back to the original?
No. There is nothing to decrypt; the information is not preserved. What attackers do instead is guess: hash enormous lists of likely inputs and look for a match. That works against short, predictable inputs such as common passwords, and not at all against a large file or a high-entropy value.
Can two different inputs produce the same SHA-256 hash?
In principle yes, because there are infinitely many possible inputs and a finite number of outputs. In practice no one has ever found such a pair for SHA-256, and finding one deliberately is considered computationally infeasible with current knowledge.
Which of SHA-256, SHA-384 and SHA-512 should I choose?
SHA-256 unless something specifically requires otherwise; it is the most widely expected and produces the shortest value. The longer variants offer a larger security margin, and SHA-512 can be marginally faster on 64-bit hardware, but for verifying a file or fingerprinting a string the difference is academic.
Does hashing the same text twice always give the same result?
Yes — that determinism is the entire basis of the technique. If you get a different value, something differs in the input: a trailing newline, invisible whitespace, or a different character encoding are the usual culprits.