The best hashing algorithm for passwords in 2026 is Argon2id, configured with at least 19 MiB of memory, 2 iterations and 1 lane of parallelism, per OWASP guidance. For data integrity and fingerprints, SHA-256 or SHA-3 are the standard choices. Fast hashes such as MD5 and SHA-1 must never be used for passwords or for security-critical integrity checks.
Key takeaways
- Argon2id is the best password hashing algorithm for new systems; scrypt is the fallback, PBKDF2 is for FIPS compliance, bcrypt is for legacy systems only.
- Passwords need slow, salted, memory-hard hashing — fast hashes like SHA-256 are for integrity checks, never for passwords.
- Every recommended algorithm is a free open standard; you pay only for the tooling around it, such as an HSM or key management.
Ask for the best hashing algorithm and you will get eleven confident answers, most of them wrong for your use case. A password needs a deliberately slow function that punishes guessing. A file checksum needs a fast one. Pick the wrong tool and you either leak passwords or waste compute — so this list sorts algorithms by the job they are actually for.
What is the best hashing algorithm?
For passwords, the best hashing algorithm is Argon2id. For data integrity, fingerprints and checksums, the best choices are SHA-256 or SHA-3. There is no single winner, because the two jobs want opposite properties.
OWASP's Password Storage Cheat Sheet is blunt about it: passwords must be protected with strong, slow hashing algorithms such as Argon2id, bcrypt or PBKDF2, with a unique salt per password. Fast hashes such as SHA-256 are not suitable for password storage, because they let attackers try huge numbers of guesses quickly.
How we chose this list: every algorithm here is judged on published guidance from OWASP, IETF RFCs and NIST, not on benchmarks or vendor claims. We cover the four password hashing functions OWASP recommends, the general-purpose hashes used for integrity, and the two legacy hashes you should stop using.
How do the best hashing algorithms compare?
Use this table to narrow the field, then read the entry for the algorithm that matches your job. Password storage and data integrity are separate columns for a reason.
| Algorithm | Best for | Passwords? | Free? | Key parameters |
|---|---|---|---|---|
| Argon2id | New password storage | Yes — first choice | Free, open standard | m=19 MiB, t=2, p=1 minimum |
| scrypt | Password storage fallback | Yes | Free, open standard | N=2^17, r=8, p=1 |
| bcrypt | Legacy password storage | Yes, legacy only | Free, open standard | Cost 10 or more; 72-byte limit |
| PBKDF2 | FIPS-regulated password storage | Yes, if FIPS required | Free, open standard | 600,000 iterations, HMAC-SHA-256 |
| SHA-256 | Integrity, fingerprints | No | Free, open standard | 256-bit output |
| SHA-512 | Integrity on 64-bit systems | No | Free, open standard | 512-bit output |
| SHA-3 | Integrity, long-term use | No | Free, open standard | 256-bit output, Keccak design |
| BLAKE3 | Fast integrity, keyed hashing | No | Free, open standard | 256-bit output, tree mode |
| HMAC-SHA-256 | Authenticated messages | As a building block | Free, open standard | 256-bit key recommended |
| MD5 | Nothing security-related | Never | Free, open standard | 128-bit output, broken |
| SHA-1 | Nothing security-related | Never | Free, open standard | 160-bit output, deprecated |
If you only remember one row, remember the first: Argon2id for new password storage. Everything else on this list is either a fallback for a specific constraint or a tool for a different job.
The best hashing algorithms, ranked for real use
Each entry below states what the algorithm is, what it is for, its recommended parameters, and when to pick something else. All eleven are free open standards — there is no license fee for any of them.
1. Argon2id — best for new password storage
Argon2id is the hybrid variant of Argon2, winner of the 2015 Password Hashing Competition and standardized as RFC 9106. It is memory-hard, so cracking it needs large amounts of RAM as well as compute, which defeats cheap GPU farms.
- Use it for: password storage in any new system.
- Parameters: at least m=19 MiB of memory, t=2 iterations, p=1 lane, per OWASP minimums. Higher-memory equivalents include 46 MiB with t=1 or 12 MiB with t=3.
- Pros: strongest resistance to GPU and side-channel attacks; tunable memory, time and parallelism; standard PHC string format carries parameters with the hash.
- Cons: needs a library in some languages; memory tuning must be benchmarked on your own servers.
- Pricing: free, open standard.
Pick Argon2id unless a constraint forces you elsewhere. If you are writing a login system from scratch in 2026, this is the default answer.
2. scrypt — best fallback when Argon2id is unavailable
scrypt is a password-based key derivation function created by Colin Percival, and the first memory-hard password hash to see wide adoption. OWASP recommends it when Argon2id is not available, for example in a runtime without an Argon2 library.
- Use it for: password storage where Argon2id is unavailable.
- Parameters: N=2^17 (128 MiB), r=8, p=1 as the OWASP minimum, with lower-memory alternatives such as N=2^16, p=2.
- Pros: memory-hard; built into many languages and runtimes, including Node.js and Python; well understood after more than a decade of use.
- Cons: higher memory use than Argon2id at equivalent strength; some runtimes cap memory below the recommended settings by default.
- Pricing: free, open standard.
Pick scrypt when your stack supports it natively and Argon2id would mean adding a dependency you cannot audit or maintain.
3. bcrypt — best for legacy systems only
bcrypt dates from 1999 and is based on the Blowfish cipher. It was the standard recommendation for over a decade, and it remains safe when tuned correctly — but OWASP says it should only be used for password storage in legacy systems where Argon2 and scrypt are not available.
- Use it for: existing systems already storing bcrypt hashes.
- Parameters: work factor of 10 or more, as large as your server allows while keeping verification under about a second.
- Pros: ubiquitous library support; adaptive cost that rises over time; proven in production for decades.
- Cons: 72-byte password input limit; not memory-hard, so GPUs attack it more cheaply than Argon2id or scrypt.
- Pricing: free, open standard.
Stay on bcrypt if you already use it and cannot justify a migration, but raise the cost factor and plan a move to Argon2id. Do not choose bcrypt for a new system in 2026.
4. PBKDF2 — best when FIPS compliance is required
PBKDF2 is the oldest function on this list, standardized in RFC 2898. It is the only password hashing function of the four that is FIPS 140 approved, which is why it survives in regulated environments long after newer algorithms appeared.
- Use it for: password storage where a FIPS 140-validated module is required.
- Parameters: 600,000 iterations or more with HMAC-SHA-256, per OWASP; 220,000 iterations with HMAC-SHA-512.
- Pros: FIPS 140 approved; available in virtually every platform, including .NET and Java standard libraries.
- Cons: not memory-hard, so it is the easiest of the four to attack with GPUs; very high iteration counts are needed to compensate.
- Pricing: free, open standard.
Pick PBKDF2 only when compliance demands a FIPS-validated module. For anything else, Argon2id gives more protection per millisecond of login time.
5. SHA-256 — best for file integrity and fingerprints
SHA-256 is the workhorse of the SHA-2 family: a fast, 256-bit hash used for file checksums, certificate fingerprints, content addressing and digital signatures. It is the right tool whenever you need to detect whether data changed.
- Use it for: file integrity, downloads, Git-style content addressing, HMAC building blocks.
- Parameters: none to tune; 256-bit output.
- Pros: fast, hardware-accelerated on most CPUs, universally supported.
- Cons: far too fast for password storage; an attacker can try billions of guesses per second.
- Pricing: free, open standard.
Use SHA-256 to answer "did this file change?", never to answer "is this the right password?". You can check a hash yourself with our free hash generator.
6. SHA-512 — best for integrity on 64-bit systems
SHA-512 is the 512-bit member of the SHA-2 family. On 64-bit processors it is often faster than SHA-256, because it processes data in 64-bit words, and its longer output gives a larger security margin.
- Use it for: integrity checks and HMAC on 64-bit servers, password pre-hashing inside PBKDF2 or HMAC constructions.
- Parameters: none to tune; 512-bit output.
- Pros: fast on 64-bit hardware; 512-bit output; same universal support as SHA-256.
- Cons: same as SHA-256 — far too fast for direct password storage.
- Pricing: free, open standard.
Pick SHA-512 over SHA-256 when you are on 64-bit hardware and want the extra output length, for example inside HMAC or a signature scheme.
7. SHA-3 — best for long-term integrity
SHA-3 is the Keccak-based hash family standardized by NIST as the successor to SHA-2. Its construction is entirely different from SHA-2, which is the point: if a weakness were ever found in SHA-2's design, SHA-3 would not share it.
- Use it for: integrity checks, signatures and any new design where you want diversity from SHA-2.
- Parameters: none to tune; SHA3-256 gives a 256-bit output.
- Pros: unrelated design to SHA-2; strong security margin; standardized and widely implemented.
- Cons: slower than SHA-256 in software on some platforms; less library support in older code.
- Pricing: free, open standard.
Pick SHA-3 for new systems where you want a modern, standards-backed integrity hash and do not need SHA-256's ecosystem or hardware acceleration.
8. BLAKE3 — best for speed-critical integrity
BLAKE3 is a fast modern hash based on BLAKE2, designed for high throughput with parallel tree hashing, keyed hashing and extendable output. It is the fastest general-purpose hash on this list on modern hardware.
- Use it for: fast file verification, content addressing, keyed hashing and key derivation in new applications.
- Parameters: none to tune; 256-bit default output, extendable to any length.
- Pros: extremely fast, including on multi-core systems; built-in keyed and tree modes; single function replaces several tools.
- Cons: newer and less universally supported than SHA-256; not a FIPS standard.
- Pricing: free, open standard.
Pick BLAKE3 when speed matters and your stack supports it, such as verifying large files or building a content-addressed store. For regulated work, SHA-256 or SHA-3 is the safer choice.
9. HMAC-SHA-256 — best for authenticated messages
HMAC is not a standalone hash but a construction that turns a hash function into a message authentication code using a secret key. HMAC-SHA-256 is the standard way to prove a message came from someone holding the key and was not altered.
- Use it for: API request signing, webhook verification, cookie integrity, and as the inner function of PBKDF2.
- Parameters: a 256-bit key, generated randomly and stored as a secret.
- Pros: proven construction; prevents tampering and forgery; available in every language.
- Cons: needs secure key storage; a leaked key breaks all authentication until rotated.
- Pricing: free, open standard.
Pick HMAC whenever you need to answer "who sent this, and was it changed?" rather than "what is the fingerprint of this data?". That distinction decides between a plain hash and HMAC.
10. MD5 — do not use for security
MD5 produces a 128-bit digest and was once the default checksum everywhere. Its collision resistance is broken, meaning attackers can craft two different inputs with the same MD5 hash, and it is extremely fast, which makes it useless for passwords.
- Use it for: non-security checksums in legacy systems where collisions do not matter, and nothing else.
- Parameters: none; 128-bit output.
- Pros: universally supported; very fast.
- Cons: broken collision resistance; 128-bit output; trivially fast for password guessing.
- Pricing: free, open standard.
If you find MD5 in a security context — password storage, signatures, file verification for downloads — replace it with SHA-256. If it is only a legacy checksum, leave it and document why.
11. SHA-1 — do not use for security
SHA-1 produces a 160-bit digest and was the standard hash of the 2000s. Practical collision attacks have been demonstrated against it, browsers and certificate authorities have distrusted it for years, and it has no place in new security designs.
- Use it for: nothing in new systems; legacy verification only where a collision carries no security consequence.
- Parameters: none; 160-bit output.
- Pros: still widely implemented for backwards compatibility.
- Cons: collision resistance broken; too fast for passwords; deprecated by NIST and the industry.
- Pricing: free, open standard.
Replace SHA-1 with SHA-256 wherever it guards anything: signatures, certificates, file verification or version control integrity. Git itself is migrating away from SHA-1 for exactly this reason.
How do you choose the right hashing algorithm?
Start from the job, not the algorithm. The decision tree is short, and it covers nearly every real situation.
- Storing a password? Use Argon2id. If it is unavailable, scrypt. If FIPS compliance is required, PBKDF2. If the system already uses bcrypt, keep it and raise the cost factor.
- Checking whether data changed? Use SHA-256 or SHA-3. Use BLAKE3 when throughput dominates and your stack supports it.
- Proving who sent a message? Use HMAC-SHA-256 with a randomly generated key stored as a secret.
- Deriving a key from a password? Use Argon2id, scrypt or PBKDF2 with a random salt — never a single fast hash.
Whatever you choose, add a unique random salt of at least 16 bytes per password, store the parameters with the hash, and benchmark the work factor on your production hardware. A hash should take well under a second to verify, and that budget is what sets your parameters. For user-facing passwords, pair good storage with a strong password policy — our free password generator creates passwords worth storing.
Free vs paid: what does hashing actually cost?
Every algorithm on this list is a free open standard, so the hashing itself costs nothing. The money goes to everything around it, and knowing the split stops you overpaying for a brand name.
| What you pay for | Free option | Paid option | When it is worth it |
|---|---|---|---|
| The algorithm | Argon2id, SHA-256, all free | None — there is no paid version | Never |
| Libraries | Open-source libraries in every language | Commercial support contracts | Regulated teams needing support SLAs |
| Secret storage | Environment variables, OS key stores | HSM or cloud KMS for peppers and keys | When a pepper or HMAC key guards real data |
| Managed auth | Self-hosted with a good library | Identity platforms that hash for you | Small teams without crypto expertise |
A hardware security module or cloud key management service is the one paid item most teams should consider, because it is where peppers and HMAC keys live. If an attacker steals your database but not your HSM, a peppered hash stays uncrackable. That is defense in depth you cannot get from a better algorithm alone.
Be wary of any product that sells you a proprietary password hashing algorithm. The standard advice in cryptography is to use vetted, public algorithms, and a vendor that will not name its algorithm is selling secrecy, not security.
What are the most common hashing mistakes?
Most password breaches are not caused by picking the second-best algorithm. They are caused by basic errors that no algorithm choice can fix.
- Storing passwords in plain text. Still found in breaches every year. Hashing is non-negotiable.
- Using a fast hash for passwords. SHA-256, SHA-1 and MD5 let attackers try billions of guesses per second on a GPU.
- Skipping the salt. Without a unique salt per password, one rainbow table cracks every account at once.
- Reusing one salt for all users. A shared salt is barely better than no salt: identical passwords still produce identical hashes.
- Truncating passwords silently. bcrypt ignores input beyond 72 bytes, so enforce a maximum length or pre-hash safely with a keyed construction.
- Hard-coding the work factor forever. Hardware gets faster; re-tune parameters yearly and re-hash on next login.
- Logging or emailing passwords. A password that appears in a log file or a welcome email is compromised before it is even stored.
Stolen passwords are also how most account takeovers start, which is why password storage matters beyond your own database. Our spear phishing guide shows how attackers use stolen credentials once they have them.
How do you migrate from a weak hash?
Migration is a gradual process, not a big bang. The standard approach keeps the old hashes working while new logins upgrade them one user at a time.
- Tag every stored hash with its algorithm and parameters, so you can tell old from new.
- On each successful login, verify against the old hash, then immediately re-hash the same password with Argon2id and store the new hash.
- Set a deadline for accounts that never log in. After it, force a password reset instead of keeping a weak hash forever.
- Prioritize privileged accounts — admins, finance and service accounts go first, even if it means resetting them proactively.
- Never decrypt or reverse old hashes to migrate them. If the old hash is unsalted MD5, you cannot upgrade it without the password, so those users must reset.
Test the migration on a staging copy with realistic login volumes before touching production. A work factor that is fine for one login a minute can fall over at a thousand, and a login outage during migration is worse than a slow one.
The bottom line
For passwords, use Argon2id with OWASP's minimum parameters, fall back to scrypt or PBKDF2 only when a constraint forces you to, and keep bcrypt for legacy systems. For integrity, use SHA-256 or SHA-3, and use HMAC when you need to prove origin as well as integrity.
The algorithm is the easy part. The hard part is the discipline around it: unique salts, stored parameters, tuned work factors, secret peppers and a migration plan for the hashes you already have. Check your own password habits with the free password strength checker.
Frequently asked questions
What is the best hashing algorithm for passwords?
Argon2id, with at least 19 MiB of memory, 2 iterations and 1 lane of parallelism. It won the 2015 Password Hashing Competition, resists both GPU and side-channel attacks, and is the first choice in OWASP guidance. Use scrypt if Argon2id is unavailable.
Is SHA-256 good for hashing passwords?
No. SHA-256 is a fast general-purpose hash, which is exactly what makes it bad for passwords: an attacker with a GPU can try billions of guesses per second. SHA-256 is excellent for file integrity and fingerprints, but passwords need a slow, salted, memory-hard function like Argon2id.
Is bcrypt still safe in 2026?
Yes, if it is tuned correctly, with a work factor of 10 or more. OWASP says bcrypt should only be used in legacy systems where Argon2 and scrypt are not available. Its 72-byte password limit and lack of memory hardness make it weaker than Argon2id for new systems.
What is the difference between hashing and encryption?
Hashing is one-way: you cannot turn a hash back into the original input, which is why it suits password storage. Encryption is two-way: data can be decrypted with the key, which is why it suits data you need to read back, like an address. Passwords should be hashed, not encrypted.
Why do passwords need a salt?
A salt is a unique random value added to each password before hashing. It stops attackers from precomputing hashes with rainbow tables and from cracking every account with one calculation. Every modern password hashing function requires a unique salt per password.
What is a pepper in password hashing?
A pepper is a secret value shared across all stored passwords and kept separate from the database, ideally in a vault or hardware security module. It adds defense in depth: an attacker who steals only the database still cannot crack the hashes. Changing a pepper forces affected users to reset their passwords.
Is MD5 still usable for anything?
Only for non-security uses such as checksums in legacy systems where collisions do not matter. MD5 must never be used for passwords, signatures or security-critical integrity checks, because it is fast and its collision resistance is broken.
How do I migrate from a weak hashing algorithm?
Keep the old hashes working, then re-hash each password with the new algorithm the next time the user signs in. Users who never return keep the old hash, so set a deadline after which unmigrated accounts must reset their password.
Sources
- OWASP — Password Storage Cheat Sheet
- IETF — RFC 9106: Argon2 Memory-Hard Function
- Security Boulevard — bcrypt vs Argon2 vs scrypt vs PBKDF2: A 2026 Decision Framework
- Software Security — Password hashing: Argon2id, scrypt, bcrypt and PBKDF2
- Software Security — Cryptography cheat sheet: which algorithm for which job
The engineers and analysts who build Cysoro's domain scanner, email-authentication checks and free security tools. We test what we write about every day — SPF, DKIM, DMARC, certificates, look-alike domains and phishing — and check each guide against the relevant standards, government guidance and vendor documentation.
Checked against the OWASP Password Storage Cheat Sheet, RFC 9106 and NIST SP 800-63B guidance on password storage.
How we write and fact-check →