When an app stores passwords, it should never keep the passwords themselves, only a hash designed to be slow to crack. Bcrypt has done this job since 1999 and is still built into most frameworks, from Laravel and Rails to Spring and Node.js. This tool lets you create and check bcrypt hashes without writing code, which is handy for seeding test accounts, resetting an admin password directly in a database, or debugging a login that won’t match.
Reading a bcrypt hash
A hash such as $2a$12$ followed by 53 characters contains everything needed to check a password:
$2a$— the algorithm version. This tool writes$2a$, which every bcrypt library accepts.12— the cost factor: 2¹² = 4,096 rounds of key setup.- The next 22 characters — the random salt.
- The last 31 characters — the hash itself.
Because the salt and cost travel with the hash, any bcrypt library can verify it later.
Choosing the cost
Each step up doubles the time a hash takes, for you and for an attacker. Generate a hash at cost 12 and note the time this tool reports. If it’s well under 100 ms on your device, your server can likely afford 13. Login only hashes once per attempt, so a quarter of a second is fine for users and very expensive for someone trying billions of guesses.
The 72-byte limit
Bcrypt only uses the first 72 bytes of a password. Anything after that is ignored, so two long passwords with the same first 72 bytes produce the same hash. The tool warns when you reach the limit. In your own code, either cap password length or pre-hash long passwords carefully.
Passwords you type here are hashed in your browser and never sent anywhere.
How to use the Bcrypt Hash Generator
- Enter a password.
- Choose a Cost factor. 12 is a common choice today.
- Click Generate hash and copy the result.
- To check a password, switch to Check a password, paste the hash and click Check.
Features
- Real bcrypt via hash-wasm (WebAssembly), with a random 16-byte salt for every hash.
- Cost factor 4 to 15, with the measured time on your device.
- Breaks the hash into version, cost, salt and hash parts.
- Verifies $2a$, $2b$ and PHP’s $2y$ hashes.
- Warns about bcrypt’s 72-byte password limit.
Frequently asked questions
What cost factor should I use?
Pick the highest cost your login servers can handle at around 100–250 ms per hash. That is usually 10 to 12 on current hardware. OWASP suggests a minimum of 10. Re-check every few years as computers get faster.
Why does the same password give a different hash each time?
Each hash includes a new random salt, stored inside the hash string. That stops attackers using precomputed tables and makes identical passwords look different in a database. Verification reads the salt back out of the hash.
What do $2a$, $2b$ and $2y$ mean?
They are versions of the format. $2b$ is the newest label, $2a$ is the most widely used, and $2y$ is PHP’s name for the fixed version. They are compatible for normal passwords; this tool writes $2a$ and verifies all three.
Should I use bcrypt or Argon2?
For new systems OWASP recommends Argon2id first and bcrypt as a solid choice where Argon2 isn’t available. Bcrypt is still widely used and secure with a sensible cost; the main thing is to use a slow, salted password hash rather than SHA-256 or MD5.
Written by Dewan Razib