Bcrypt Generator & Checker
Hash passwords with bcrypt and verify $2a$, $2b$ and $2y$ hashes in your browser, with a warning when a password passes the 72-byte limit.
Bcrypt Generator Tool
How to use the bcrypt generator
Hash mode
Enter a password and pick the cost factor (4 to 14). Each step up doubles the work. OWASP recommends bcrypt only for legacy systems, with a cost of at least 10; the page shows how long your browser took.
Read the hash
The output is a 60-character string such as $2a$10$…: the version, the cost, a 22-character salt and the 31-character hash, in bcrypt's own radix-64 alphabet. PHP's password_verify(), Node's bcrypt libraries and others read it directly.
Verify mode
Paste a hash and a candidate password. The cost and salt are read from the hash itself, the password is hashed again with them, and the tool tells you whether it matches. Hashes starting $2a$, $2b$ or $2y$ (the PHP prefix) are accepted.
Note the same-password-different-hash rule
bcrypt adds a random 128-bit salt to every hash, so hashing the same password twice gives two different strings, and both verify. Only the first 72 bytes of a password count; the tool warns you if yours is longer.
bcrypt — the password-storage standard that has aged well
bcrypt is a password-hashing function published by Niels Provos and David Mazières at the 1999 USENIX conference (Provos and Mazières, USENIX 1999). It was designed for OpenBSD to make each password guess deliberately expensive, and to let that expense rise as hardware gets faster, through a single cost parameter.
How it works
bcrypt is built on the Blowfish cipher. Its "EksBlowfish" key schedule mixes in a 128-bit salt and the password, then repeats the expensive part 2cost times, so cost 10 means 1,024 rounds and each step up doubles the work. The resulting state encrypts the 192-bit text "OrpheanBeholderScryDoubt" 64 times, and the output is stored with the version, cost and salt in one string. Verifying a password repeats exactly the same steps with the stored cost and salt.
"For legacy systems using bcrypt, use a work factor of 10 or more and with a password limit of 72 bytes." OWASP Password Storage Cheat Sheet
The 72-byte limit
The original paper describes passwords of up to 56 bytes; common implementations, including the bcryptjs library this page uses, take up to 72 bytes and ignore the rest. Checked here: a 77-character password verifies against the hash of its first 72 characters. OWASP recommends enforcing a maximum of 72 bytes, or pre-hashing longer passwords with care. Note that the limit is in bytes, so a password in Chinese or with emoji reaches it in fewer characters.
Prefixes
You will see $2a$, $2b$ and $2y$ at the start of bcrypt hashes. They mark versions of the algorithm and its implementations; PHP's password_hash(), for example, "will produce a standard crypt() compatible hash using the $2y$ identifier", according to the PHP manual. Since PHP 8.4 its default bcrypt cost is 12, up from 10. This page produces $2a$ hashes and verifies all three prefixes.
bcrypt, Argon2 and PBKDF2
For new systems OWASP recommends Argon2id, the winner of the 2015 Password Hashing Competition, with at least 19 MiB of memory, 2 iterations and 1 degree of parallelism; scrypt if Argon2id is unavailable; bcrypt for legacy systems; and PBKDF2 with HMAC-SHA-256 and at least 600,000 iterations where FIPS-140 compliance is required. Whatever you use, hash passwords on the server: hashing in the browser, as this teaching tool does, exposes the password to anything else running on the page.
How bcrypt works, its 72-byte limit and what OWASP recommends now
bcrypt was published by Niels Provos and David Mazières at the 1999 USENIX Annual Technical Conference.
Each password gets a random 128-bit salt, so the same password never hashes to the same string twice.
The expensive step runs 2cost times: cost 10 is 1,024 rounds, and each step up doubles the work.
The final state encrypts the 192-bit text "OrpheanBeholderScryDoubt" 64 times.
Common implementations use only the first 72 bytes of a password; the paper itself describes 56.
OWASP recommends bcrypt only for legacy systems, at a cost of 10 or more.
For new systems OWASP recommends Argon2id, winner of the 2015 Password Hashing Competition.
Where FIPS-140 compliance is required, OWASP points to PBKDF2-HMAC-SHA-256 with at least 600,000 iterations.
PHP's password_hash() writes the $2y$ prefix; its default cost rose from 10 to 12 in PHP 8.4.
A bcrypt hash is 60 characters: version, cost, 22-character salt and 31-character hash.
Frequently asked questions
Method & sources
How it computes
Hashes with self-hosted bcryptjs 2.4.3 (genSaltSync(cost), hashSync, compareSync) at cost 4-14, and verifies 60-character $2a$, $2b$ and $2y$ hashes. Warns when the password exceeds 72 UTF-8 bytes, the limit OWASP gives and this build enforces (a 77-byte password verifies against the hash of its first 72).
What this tool implements
- The verifier rejected $2y$ hashes, PHP's prefix (password_hash), although bcryptjs verifies them; every PHP and Laravel hash failed here. Longer-than-72-byte passwords were hashed with no warning. Both fixed; tested against the vendored library.
- OWASP: Argon2id for new systems (19 MiB, t=2, p=1), bcrypt for legacy at work factor 10+, PBKDF2-HMAC-SHA-256 at 600,000+ for FIPS. The page had Argon2id at '64MB, t=3'. Construction per Provos and Mazières (128-bit salt, 2^cost rounds, 'OrpheanBeholderScryDoubt' 64 times); PHP 8.4 raised its default cost to 12.
- Removed as unsourced: a quoted MAS TRM / BNM RMiT requirement, the 2012 LinkedIn breach figures, GPU hash rates, a '2014 OpenBSD bug' account of $2b$, 'every WordPress install', and Django/Rails pre-hashing claims.
Sources
- Provos N, Mazières D. A Future-Adaptable Password Scheme. Proceedings of the FREENIX Track, 1999 USENIX Annual Technical Conference. https://www.usenix.org/legacy/events/usenix99/provos/provos.pdf
- OWASP. Password Storage Cheat Sheet. https://cheatsheetseries.owasp.org/cheatsheets/Password_Storage_C…
- PHP Manual. password_hash (PASSWORD_BCRYPT, $2y$ identifier; default cost 12 from PHP 8.4). https://www.php.net/manual/en/function.password-hash.php
Pick up where you left off
Stored only in this browser — never sent to our servers.