SHA-256 Password Hashing: Why Plain SHA-256 Falls Short
You can hash a password with SHA-256 in a second: type it into GrabCast's Hash Generator and copy the 64-character hex value. You should not store that value as a login credential, because SHA-256 is designed to be fast, and a single modern graphics card can test billions of SHA-256 guesses per second against a leaked database. This guide explains what actually happens when a password meets SHA-256, what salts and peppers fix and what they do not, and which slow algorithms security teams recommend instead, with the parameters OWASP publishes. It also covers the jobs where SHA-256 genuinely belongs in a login system, such as storing reset tokens, so you can use the right tool for each part rather than dropping SHA-256 entirely.
๐ Try the Hash Generator tool now โ freeOpen โ
Databases leak. When they do, the storage algorithm decides whether attackers recover most user credentials in an afternoon or almost none in a year. Because people reuse credentials, a weak choice on one site becomes account takeovers on email, banking and shopping sites. Fast digests like SHA-256 make guessing cheap; slow, memory-hard functions make every guess expensive. Regulators and auditors increasingly treat plain or merely salted SHA-256 storage as a finding, and it is also one of the first things a security reviewer checks in a new app.
What SHA-256 does to a password, step by step
SHA-256 turns any input into 256 bits, shown as 64 hex characters. It is deterministic: password123 always becomes ef92b778bafe771e89245b89ecbc08a44a4e166c06659911881f383d4473e94f, on every site and every computer. That property is perfect for file checks and terrible for stored credentials.
- Attackers keep precomputed lists of digests for billions of common choices, so a leaked unsalted value for password123 is reversed by a simple lookup.
- Two users with the same secret get the same digest, revealing which accounts share it.
- Speed is the core problem: commodity GPUs compute billions of SHA-256 values per second, so eight-character secrets fall to brute force quickly.
- The Hash Generator itself carries a note saying exactly this: use SHA-256 for integrity and a slow KDF such as bcrypt or Argon2 for logins.
Salts, peppers and why they are not enough alone
A salt is a random value, typically 16 bytes, generated per user and stored next to the digest. Hashing salt plus secret defeats precomputed lists and makes identical secrets look different. A pepper is an extra secret key kept outside the database, often applied with HMAC.
- Salting forces attackers to crack each account separately, but each guess still costs a single fast SHA-256 call.
- Try it in the tool: tick HMAC, type any key, and watch every digest change completely; that is how a pepper behaves.
- A pepper helps only if it stays secret, so keep it in a secrets manager or environment variable, never in the same database dump.
- Salt and pepper improve fast digests, but they do not slow down guessing. Only a deliberately expensive function does that.
What to use instead: Argon2id, bcrypt, scrypt, PBKDF2
The OWASP Password Storage Cheat Sheet lists slow, tunable functions and minimum settings. Choose the first one your platform supports well, then raise the cost until a login takes a fraction of a second on your server.
- Argon2id: at least 19 MiB of memory, 2 iterations and 1 degree of parallelism. Libraries include argon2-cffi for Python and argon2 for Node.js.
- bcrypt: a work factor of 10 or more. It only uses the first 72 bytes of input, so very long passphrases are silently truncated.
- scrypt: N of 2 to the 17th, r of 8 and p of 1 is the OWASP baseline.
- PBKDF2 with HMAC-SHA256: 600,000 iterations, useful when FIPS compliance rules out the others. PHP's password_hash and Django's defaults already handle salts and settings for you.
If you also need to create or test passwords, use the Password Generator for new ones and the Password Breach Checker to see whether an old one has leaked.
Where SHA-256 does belong in a login system
SHA-256 is still the right choice for secrets that are long and random rather than chosen by people. Guessing a 32-byte random token is impossible regardless of digest speed, so a fast function is fine.
- Store password-reset and email-verification tokens as SHA-256 digests, so a database leak does not hand attackers working links.
- Store API keys the same way and show the full key to the user only once, at creation.
- Have I Been Pwned's range API accepts the first five characters of a SHA-1 digest, so apps can check breached secrets without sending them; the tool's SHA-1 row shows that prefix for a test value.
- For learning or unit-test fixtures, compute digests of sample values in the browser tool rather than real ones; nothing is uploaded, but a live secret should not be typed anywhere it is not needed.
Step-by-step


Common mistakes to avoid
Pro tips
Frequently asked questions
Is SHA-256 secure for passwords?
Not on its own. SHA-256 is cryptographically strong for integrity, but it is fast, which makes brute-force guessing cheap. Use Argon2id, bcrypt, scrypt or PBKDF2, which are designed to be slow and tunable.
Does adding a salt make SHA-256 safe?
It defeats precomputed tables and hides duplicate secrets, which is important, but each guess still costs one fast SHA-256 calculation. A slow key-derivation function is still needed.
Can a SHA-256 value be decrypted?
No. It is a one-way function, not encryption. Attackers recover inputs by guessing and comparing, which is why common and short secrets fall quickly while long random ones do not.
Can I generate a bcrypt or Argon2 value in the Hash Generator?
No. The tool computes MD5, SHA-1, SHA-256, SHA-384, SHA-512, CRC32 and HMAC variants. For bcrypt or Argon2, use your framework's password API or a dedicated library.
How do I migrate existing SHA-256 records?
Wrap them: compute Argon2id or bcrypt over the existing SHA-256 digest for every user immediately, then replace each wrapped value with a direct slow digest the next time that user signs in successfully.
SHA-256 is an excellent integrity function and a poor way to store secrets people choose. Salt and pepper help, but only a slow function such as Argon2id or bcrypt makes stolen records expensive to crack. Keep SHA-256 for random tokens and API keys, and use the Hash Generator to learn and test with sample values.
Related guides
Browse more: all text and developer guides ยท the Hash Generator tool
