Developer Toolsintermediate

bcrypt vs Argon2

bcrypt vs Argon2 compared for 2026: the bcrypt and argon2 npm packages benchmarked on Node.js 22, with OWASP's current parameters, the 72-byte bcrypt limit, memory use under load, rehashing and migration. Includes hash, verify and concurrency timings we measured on 4 December 2026.

Quick Answer

Use Argon2id for new systems and keep bcrypt only where it already runs. OWASP's Password Storage Cheat Sheet (read 4 December 2026) puts Argon2id first, with a minimum of 19 MiB memory, 2 iterations and parallelism 1, and lists bcrypt for legacy systems with a work factor of 10 or more and a 72-byte input limit. In our runs on Node.js 22.23.5, one core: bcrypt 6.0.0 at cost 10 took about 52 ms per hash and per compare, cost 12 about 210 ms. argon2 0.45.2 with OWASP's minimum took about 22 ms; its own defaults (64 MiB, 3 passes, 4 lanes) took about 160 ms and added 257 MB of peak memory when 16 logins ran at once. bcrypt silently ignored everything after byte 72: a 72-character password with a different suffix, and 18 emoji followed by an extra character, both matched. Argon2 rejected both. Argon2 costs memory on every login, so size it for peak concurrency; bcrypt costs only CPU. Migrate by verifying the old bcrypt hash at login and re-hashing with Argon2id.

Last updated December 4, 2026. Covers bcrypt 6.0.0 (11 May 2025), bcryptjs 3.0.3, argon2 0.45.2 (3 November 2026) and @node-rs/argon2 2.2.2; npm registry metadata and download counts, GitHub repositories and release notes, package READMEs and type definitions, the bcrypt CHANGELOG, Node.js crypto docs and OWASP's Password Storage Cheat Sheet read on 4 December 2026, plus latency, concurrency, memory and behaviour tests we ran that day.

Feature comparison of bcrypt vs Argon2
FeaturebcryptArgon2
OWASP Guidance (read 4 Dec 2026)
Legacy systems only; work factor >= 10; enforce a 72-byte limit
First choice: Argon2id, minimum m=19 MiB, t=2, p=1
npm Package, Latest Release, Licence
bcrypt 6.0.0 (11 May 2025), MIT
argon2 0.45.2 (3 Nov 2026), MIT
npm Weekly Downloads (27 Nov-3 Dec 2026)
6,859,902 (bcryptjs: 16,358,921)
3,074,878 (@node-rs/argon2: 2,786,772)
GitHub Repository
kelektiv/node.bcrypt.js, ~7.8k stars, 38 open issues and PRs
ranisalt/node-argon2, ~2.2k stars, 7 open issues and PRs
Our Run: Install (packages / size)
3 packages, 1.8 MB (bcryptjs: 1 package, 164 KB)
12 packages, 1.9 MB
Package Defaults
Cost 10
Argon2id, m=65536 KiB (64 MiB), t=3, p=4
Our Run: Hash at Package Defaults (1 core)
~52 ms (cost 10); ~111 ms (cost 11); ~210 ms (cost 12)
~160 ms
Our Run: Hash at OWASP Minimum (1 core)
~52 ms (cost 10 is OWASP's minimum)
~22 ms (m=19456, t=2, p=1); @node-rs/argon2 ~11 ms
Our Run: Verify (1 core)
~52 ms at cost 10, ~213 ms at cost 12
~23 ms at OWASP minimum, ~176 ms at defaults
Our Run: 16 Concurrent Verifies (2 cores)
Cost 10: 36.5-37.6 per second; cost 12: 9.1-9.2 per second
OWASP minimum: 51-82 per second; defaults: 8.9-11.4 per second
Our Run: Peak Extra Memory, 16 Concurrent
No measurable increase
Defaults: +257 MB; OWASP minimum: +57 MB (+129 / +19 MB with UV_THREADPOOL_SIZE=2)
Our Run: Long Passwords
Truncated at 72 bytes: a different suffix after 72 bytes still matched
No truncation: different suffixes rejected; 1 MB password hashed in 36 ms
Our Run: 18 Emoji (72 bytes) + 1 Character
Matched (truncated at byte 72)
Rejected (whole input used)
Stored Hash Format
$2b$10$ + salt + digest, 60 characters
PHC string $argon2id$v=19$m=...,t=...,p=...$salt$hash, 97 characters at defaults
Cost Parameters
Cost factor 4-31 (log2 iterations); values outside are clamped
memoryCost (KiB), timeCost (passes), parallelism (lanes), type, hashLength
Rehash Detection
Manual: compare bcrypt.getRounds(hash) with your target cost
argon2.needsRehash(hash, options) built in
Secret / Pepper Support
None built in; OWASP suggests HMAC pre-hash with a pepper, base64-encoded
secret option (verify without it returned false)
Sync API and Event Loop
hashSync / compareSync block the event loop (4 calls held a 1 ms timer for 259 ms)
Promise API only; a 1 ms timer fired on time during a hash
Pure-JS / Alternative Builds
bcryptjs (pure JS, ~1.3x slower in our run); @node-rs/bcrypt (Rust)
@node-rs/argon2 (Rust, prebuilt); node:crypto argon2 from Node.js 24.7.0 (no PHC helpers)
Node.js Requirement
Node.js >= 18
engines >= 16.17.0; README: tested on Node.js >= 22

bcrypt

bcrypt is the long-established adaptive password hash, and bcrypt on npm is the native Node.js binding maintained in kelektiv/node.bcrypt.js. It exposes hash, compare, genSalt and getRounds in callback, promise and sync forms, and runs the async calls on libuv's thread pool. The only knob is the cost factor: each step doubles the work (2^cost iterations), and the default is 10. Hashes are 60-character modular crypt strings such as $2b$10$ followed by a 22-character salt and the digest, so the cost and salt travel with every hash. Version 6.0.0 (published to npm on 11 May 2025) dropped Node.js 16 and older and switched to prebuildify, so prebuilt binaries for Linux, macOS and Windows now ship inside the package instead of being downloaded at install. Version 5.0.0 fixed a wrap-around bug that weakened passwords of 255 characters or more. The algorithm reads only the first 72 bytes of its input, and the README says so: bytes, not characters. The pure-JavaScript bcryptjs package (3.0.3) produces compatible hashes without a native build and is downloaded more than twice as often.

Pros

  • Fixed, tiny memory cost: 16 concurrent compares added no measurable memory in our run
  • Universally supported: the same $2b$ hash verifies in bcryptjs, PHP, Python, Go, Ruby and Java libraries
  • One parameter to tune; cost 10 took about 52 ms and cost 12 about 210 ms per hash on one core
  • Prebuilt binaries ship in the package since 6.0.0 (3 packages, 1.8 MB installed)
  • Drop-in pure-JS fallback (bcryptjs) when native modules are not allowed
  • Accepted by OWASP for existing systems at work factor 10 or more

Cons

  • Silently ignores everything after 72 bytes: two passwords sharing a 72-byte prefix matched in our test
  • Not memory-hard: its cost is CPU time only, so it does less to slow GPU guessing than Argon2id
  • OWASP now recommends it only for legacy systems where Argon2id and scrypt are unavailable
  • Out-of-range costs are clamped without an error: 3 became 4, 32 became 31
  • Rejected a $2y$ (PHP-style) prefix in compare() although bcryptjs accepted it; last release May 2025

Best For

Existing user tables already hashed with bcrypt, environments that cannot spare memory per login, and stacks that need one hash format readable by every language. Keep the cost at 10 or more and cap passwords at 72 bytes.

Argon2

Argon2 won the Password Hashing Competition in 2015 and is specified in RFC 9106. It is memory-hard: every hash fills a block of memory you choose, which is what makes large-scale guessing on GPUs expensive. Of its three variants, OWASP recommends Argon2id, the hybrid of the data-independent Argon2i and the data-dependent Argon2d. The argon2 npm package (ranisalt/node-argon2) binds the reference C implementation and exposes hash, verify and needsRehash, all promise-based, with no synchronous variant. Its defaults are Argon2id with 64 MiB of memory (memoryCost 65536 KiB), 3 passes and parallelism 4, and its README says there is no need to change them. Output is a PHC string such as $argon2id$v=19$m=65536,t=3,p=4$ followed by the salt and digest, 97 characters at the defaults, so parameters change without a schema change. It also accepts a secret (pepper) and associated data. 0.45.0 (18 July 2026) stopped testing Node.js 18 and 20, and 0.45.2 (3 November 2026) fixed the order of PHC parameters. Node.js itself gained crypto.argon2() in v24.7.0, but the package's README notes the native API has no PHC formatting, verify, rehash check or default parameters. @node-rs/argon2 (2.2.2) is a Rust alternative with OWASP-level defaults.

Pros

  • OWASP's first choice: Argon2id at 19 MiB, t=2, p=1 or one of the listed equivalents
  • Memory-hard: raises the cost of GPU cracking, not just CPU time
  • No input truncation: a 1 MB password hashed in 36 ms and different suffixes after byte 72 did not match
  • PHC string stores algorithm, version, memory, passes and lanes; needsRehash() compares them for you
  • Built-in secret (pepper) option: the same hash failed to verify without it
  • Fast at OWASP's minimum: about 22 ms per hash, 11 ms with @node-rs/argon2

Cons

  • Memory per login: 16 concurrent verifies at the package defaults added 257 MB of peak memory
  • Package defaults (64 MiB, t=3, p=4) took about 160 ms per hash on one core, three times OWASP's minimum
  • Three parameters to choose and size against concurrency and container memory limits
  • Install pulls 12 packages because cross-env is a runtime dependency
  • No sync API, and the README says it is tested only on Node.js 22 and later while package.json still allows 16.17

Best For

Any new system storing passwords, teams that want to tune cost by memory as well as time, apps that need a pepper or parameter upgrades without a migration, and services under compliance reviews that cite OWASP.

Where the recommendations stand in 2026

We read OWASP's Password Storage Cheat Sheet on 4 December 2026. Its summary is ordered: use Argon2id with at least 19 MiB of memory, 2 iterations and a parallelism of 1; if Argon2id is unavailable, use scrypt with N=2^17, r=8, p=1; for legacy systems using bcrypt, use a work factor of 10 or more and a 72-byte password limit; use PBKDF2 with 600,000 iterations of HMAC-SHA-256 when FIPS-140 is required. The bcrypt section goes further and says bcrypt should only be used in legacy systems where Argon2 and scrypt are not available. For Argon2id it lists equivalent settings that trade memory for passes: 46 MiB with t=1, 19 MiB with t=2, 12 MiB with t=3, 9 MiB with t=4 and 7 MiB with t=5, all with p=1. None of this makes bcrypt broken. A bcrypt hash at cost 10 or more is still slow to attack, and a great many existing user tables rely on it. The difference is that Argon2id's memory cost limits how many guesses an attacker can run in parallel on a GPU, while bcrypt's cost is CPU time alone. If you are choosing today, the guidance picks for you; if you already run bcrypt, the guidance is to keep its cost up and plan a migration, not to panic. Our Hash Generator and Bcrypt Generator tools are handy for inspecting the formats discussed here.

What we measured: latency, throughput and memory

On 4 December 2026 we installed bcrypt 6.0.0, bcryptjs 3.0.3, argon2 0.45.2 and @node-rs/argon2 2.2.2 on Node.js 22.23.5 in a 2-vCPU sandbox. Single-hash latency, pinned to one core, median of seven: bcrypt cost 10 52 ms, cost 11 111 ms, cost 12 210 ms; compare took the same time as hash. bcryptjs needed 71 ms at cost 10 and 266 ms at cost 12. argon2 at its defaults (64 MiB, t=3, p=4) took 160 ms to hash and 176 ms to verify; with only one core the four lanes did not help, and t=3, p=1 cost the same 159 ms. At OWASP's minimum (19 MiB, t=2, p=1) it took 22 ms, and 46 MiB with t=1 took 44 ms. @node-rs/argon2 hashed the OWASP setting in 11 ms. Then we ran 16 verifies at once on both cores with the default libuv pool of four threads, three times. bcrypt sustained 36.5-37.6 verifies per second at cost 10 and 9.1-9.2 at cost 12, with no measurable memory growth. argon2 managed 51-82 per second at OWASP's minimum with 57 MB of extra peak memory, and 8.9-11.4 per second at its defaults with 257 MB. Halving the pool to two threads halved the memory (129 MB and 19 MB) at similar throughput. These are small synthetic runs on one machine; measure on your own hardware before choosing a cost.

The 72-byte limit and other behaviour we checked

bcrypt's input limit is documented, but it is easy to forget what it means in practice. We hashed a 72-character ASCII password with bcrypt and then called compare() with the same 72 characters plus a completely different suffix: it returned true. The same happened with 18 lock emoji (18 characters, 72 bytes in UTF-8) followed by one more character. bcryptjs behaved the same and has a truncates() helper that returned true for the longer string. Argon2 returned false in both cases and hashed a 1 MB password in 36 ms, so it has no practical length cap; put your own maximum in place to avoid denial-of-service by huge inputs. Other things worth knowing from our runs: bcrypt 6 handled an embedded NUL byte correctly ('abc\0def' did not match 'abc'), a fix that arrived in 5.0.0. bcrypt clamps the cost silently, so genSaltSync(3) produced $2b$04$ and genSaltSync(32) produced $2b$31$, and a hash at cost 32 was still running five minutes later when we stopped it. The native bcrypt package returned false for a hash whose prefix we changed to $2y$ (the PHP spelling), while bcryptjs accepted it, so rewrite $2y$ to $2b$ when importing PHP hashes. argon2.verify() given a bcrypt hash returned false instead of throwing, which matters for the migration code below.

Migrating from bcrypt to Argon2id

You cannot convert a bcrypt hash into an Argon2 hash, because you do not have the passwords. The usual path is rehash-on-login. Read the stored hash; if it starts with $2a$ or $2b$, verify it with bcrypt.compare(); on success, hash the submitted password with argon2.hash() and overwrite the row. If it starts with $argon2id$, verify with argon2.verify(), then call argon2.needsRehash(hash, currentOptions) and re-hash when it returns true. In our run needsRehash returned true for a hash made with the package defaults when we passed OWASP's minimum, and false for a matching hash, so the same code also handles future parameter changes. Branch on the prefix rather than trying one library and falling back to the other, because argon2.verify() returns false for a bcrypt hash and a fallback written as a catch block will never run. Accounts that never log in keep their bcrypt hashes indefinitely; OWASP's guidance on upgrading work factors suggests you may force a reset for those. An alternative that upgrades everyone at once is wrapping: store argon2(bcryptHash) and verify with argon2(bcrypt(password, storedSalt)), at the price of more code and two algorithms forever. If you add a pepper, Argon2's secret option is built in, and the hash we made with a secret failed to verify without it, as it should.

Limits, operations and when bcrypt is still the right call

Argon2's strength is also its operating cost. Every concurrent login allocates memoryCost kibibytes per lane for the duration of the hash, so a login burst on a small container can push it into swap or an out-of-memory kill. At the package defaults we saw 257 MB of extra memory for 16 parallel verifies; at OWASP's minimum, 57 MB. Cap concurrency with UV_THREADPOOL_SIZE or a queue, and rate-limit login endpoints whichever algorithm you use, because OWASP notes that high work factors can be abused for denial of service. bcrypt has no such memory spike, which is why it can still be the pragmatic choice on very constrained hosts, on platforms whose other services can only verify bcrypt, or when you are maintaining a large existing table and cannot schedule a migration yet. Keep the async APIs in servers: four bcrypt compareSync calls held a 1 ms timer for 259 ms in our test, while argon2 has no sync API and our timer fired on time. On packaging, bcrypt 6 and argon2 both ship prebuilt binaries, but argon2 installs 12 packages because cross-env is a runtime dependency, and its README says it is tested only on Node.js 22 and later. Native crypto.argon2() exists from Node.js 24.7.0 but leaves PHC encoding and verification to you. For the identity layer around all this, see our Clerk vs Auth0 and Better Auth vs Clerk comparisons.

Verdict

Pick Argon2id for anything new. It is OWASP's first recommendation, it makes every guess cost memory as well as CPU, it hashes the whole password instead of the first 72 bytes, and the argon2 package gives you a PHC string with parameters inside it plus needsRehash() for upgrades. Start from OWASP's minimum (memoryCost 19456, timeCost 2, parallelism 1) or a heavier row from its table, then measure: in our run that setting cost about 22 ms per login on one core and 57 MB of extra memory for 16 simultaneous logins, while the package defaults cost about 160 ms and 257 MB. Size memoryCost against your peak concurrent logins and container limit, not against a single request. Keep bcrypt where it already runs, at cost 10 or higher, and reject passwords longer than 72 bytes so users are not misled about what protects them. Move off it by verifying the bcrypt hash at the next login and storing a new Argon2id hash. Choose bcrypt for new work only if you cannot afford tens of megabytes per concurrent login or a platform in your stack cannot verify Argon2.

All Comparisons

bcrypt vs Argon2 — FAQ

Common questions answered from the comparison above

Is Argon2 better than bcrypt?

For new systems, yes according to OWASP's Password Storage Cheat Sheet, which recommends Argon2id first and bcrypt only for legacy systems. Argon2id is memory-hard, has no 72-byte input limit and stores its parameters in the hash. bcrypt at cost 10 or more is still acceptable where it is already in use.

What Argon2 parameters should I use in Node.js?

OWASP's minimum is Argon2id with 19 MiB of memory, 2 iterations and parallelism 1 (argon2.hash(pw, { memoryCost: 19456, timeCost: 2, parallelism: 1 })). That took about 22 ms per hash on one core in our run. The argon2 package defaults (64 MiB, t=3, p=4) are stronger but took about 160 ms and much more memory under load.

Does bcrypt really ignore characters after 72?

It ignores bytes after 72, which can be fewer than 72 characters. In our test a 72-character password with a different suffix matched, and so did 18 emoji (72 bytes) followed by another character. Enforce a 72-byte maximum or pre-hash with an HMAC and pepper as OWASP describes.

What bcrypt cost factor should I use in 2026?

At least 10, per OWASP, and as high as your login latency allows. On our sandbox core, cost 10 took about 52 ms, cost 11 about 111 ms and cost 12 about 210 ms; each step doubles the time.

How do I migrate from bcrypt to Argon2?

Rehash on login: if the stored hash starts with $2a$ or $2b$, verify it with bcrypt.compare() and, on success, save argon2.hash() of the submitted password. Branch on the prefix, because argon2.verify() returns false for a bcrypt hash rather than throwing. Use argon2.needsRehash() to apply later parameter changes.

Should I use bcrypt or bcryptjs?

Both produce compatible $2b$ hashes. bcrypt is native and was about 25% faster in our run (52 ms vs 71 ms at cost 10); bcryptjs is pure JavaScript, installs as one 164 KB package and works where native modules cannot. bcryptjs is downloaded more than twice as often.

Get the next comparison by email

One email a week: new and trending developer tools, fresh comparisons, and what shipped. Unsubscribe in one click.