Bcrypt Generator & Verifier
Generate Bcrypt
Bcrypt Components
The stored bcrypt string combines version, cost, salt, and hash. Store the complete string, not just the final hash portion.
Verify Bcrypt
About this tool
Generate bcrypt password hashes and verify passwords against existing bcrypt strings. Bcrypt is a password hashing algorithm designed to protect stored passwords against offline cracking attacks.
Hashing and verification run locally in your browser using bcrypt.js,
loaded from cdnjs.cloudflare.com. The CDN receives a script
request and your IP address, but your passwords are not sent to it.
Passwords and hashes are not saved in browser storage, so reloading
the page clears them.
How to use
- Enter a plaintext password and select a cost factor.
- Click Generate Bcrypt to create a hash.
- Copy the full 60-character string or inspect its individual components.
- To verify a password, enter the password and its existing bcrypt string, then click Verify Password.
Why was bcrypt invented?
Bcrypt was introduced in 1999 by Niels Provos and David Mazières in their paper A Future-Adaptable Password Scheme. It was developed in response to a fundamental problem with traditional password hashing: computers were becoming faster, while human passwords were not becoming significantly stronger.
Traditional hashing algorithms are designed to compute results quickly. This is useful for data integrity checks, but dangerous for password storage. If attackers steal a database of password hashes, they can test enormous numbers of password guesses offline.
Bcrypt addresses this problem with an intentionally expensive computation and an adjustable cost factor. As hardware becomes more powerful, applications can increase the cost to make each password guess more expensive.
Read the original 1999 USENIX paper.
What security problems does bcrypt solve?
- Rainbow table attacks: Rainbow tables are precomputed lookup structures used to recover passwords from hashes without repeating all the calculations. Bcrypt uses a different random salt for each hash, making general-purpose precomputed tables ineffective.
- Fast offline password guessing: Algorithms such as MD5 and SHA-256 are fast, allowing attackers to test many guesses per second. Bcrypt deliberately increases the computational cost of each guess.
- Identical password detection: Without a salt, users sharing the same password produce identical hashes. With independently generated salts, their bcrypt strings differ even when their passwords are identical.
- Improving attacker hardware: Bcrypt supports configurable work factors, allowing systems to increase hashing difficulty over time.
Bcrypt does not make weak passwords impossible to crack. It increases the cost of guessing them. Strong passwords, login rate limiting, and multi-factor authentication remain important.
Why does bcrypt use a salt?
Consider two users who choose the same password, 123456.
Without a unique salt, a deterministic hashing algorithm produces
the same output for both users.
Without salt:
User A: SHA256("123456") -> Hash X
User B: SHA256("123456") -> Hash X
With unique salts:
User A: bcrypt("123456", Salt A) -> Hash A
User B: bcrypt("123456", Salt B) -> Hash B
Hash A != Hash B
If attackers obtain a database of unsalted hashes, they can reuse previously computed password guesses across many accounts. Unique salts force them to perform separate calculations for different salts.
Salt is not a secret key. Bcrypt includes the salt directly in its stored output, allowing the same parameters to be reused during password verification.
Bcrypt vs regular hashing
Bcrypt and algorithms such as SHA-256 serve different purposes. SHA-256 is designed for efficient general-purpose hashing. Bcrypt is specifically designed for protecting passwords.
- SHA-256: Fast, deterministic, and useful for file integrity, checksums, and cryptographic applications.
- Bcrypt: Intentionally slow, salted, and designed for password storage and verification.
- Configurable cost: Bcrypt allows applications to increase computational difficulty without changing the user's password.
- Output: A bcrypt string contains the algorithm version, cost, salt, and resulting hash.
Adding a salt to SHA-256 does not make it equivalent to bcrypt. The salted SHA-256 computation is still fast, so offline attackers can test candidate passwords efficiently.
Bcrypt string format
$2b$12$abcdefghijklmnopqrstuuXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX │ │ │ └─ Hash: 31 characters │ │ └─ Salt: 22 characters │ └─ Cost: 12 (2^12 work factor) └─ Version: 2b
A typical bcrypt string contains 60 characters. Its cost and salt are included in the string, so no separate database columns are required for them.
The cost factor controls the amount of computation. Increasing the cost from 12 to 13 approximately doubles the work required for both hashing and verification.
How does bcrypt verification work?
Bcrypt is a one-way function. Applications do not decrypt stored hashes to check passwords. Instead, they recompute the hash using the original salt and cost extracted from the stored bcrypt string.
Registration:
Password + Random Salt + Cost
|
v
Bcrypt Hash
|
v
Store bcrypt string
Login:
Entered Password + Stored Salt + Stored Cost
|
v
Recompute Hash
|
v
Compare with stored hash
|
Match / No Match
This design allows password verification without storing or recovering the original plaintext password.
Where is bcrypt used in real applications?
Bcrypt is commonly used in backend authentication systems where applications must store and verify user-selected passwords.
- User registration: When a user creates an account, the backend hashes the password with bcrypt and stores the resulting string instead of plaintext.
- User login: The backend retrieves the stored bcrypt string and checks the submitted password against it.
- Password reset: After a user completes a secure recovery procedure, the new password is hashed with a fresh salt and replaces the old hash.
- Administrator accounts: Internal management systems can use bcrypt to protect administrator passwords, including passwords established during initial setup.
- Authentication system migration: Applications can verify existing bcrypt hashes and, after successful authentication, rehash passwords with a stronger configuration or a newer algorithm.
Example: In a Java Spring Security application, BCryptPasswordEncoder can encode passwords during registration and verify them during login. The stored bcrypt string is typically kept in the user's password column.
When should you use bcrypt?
Bcrypt is appropriate for password storage in existing systems, especially when compatibility with established authentication libraries is required.
For new applications, OWASP currently recommends Argon2id over bcrypt where available. Argon2id adds memory-hard computation, providing stronger resistance to many hardware-accelerated attacks.
Do not use bcrypt for file checksums, ordinary data fingerprints, or general-purpose hashing. Its deliberately expensive computation is unnecessary for those use cases.
See the OWASP Password Storage Cheat Sheet for current recommendations.
Limits and security
- Bcrypt uses at most the first 72 UTF-8 bytes of a password in most implementations. This tool rejects longer inputs to avoid silent truncation.
- The generator offers cost factors 8–14. Higher factors require exponentially more computation.
- For production bcrypt systems, OWASP recommends a work factor of at least 10, adjusted based on server performance.
- The browser verifier accepts
$2a$,$2b$, and$2y$hashes with cost factors up to 16 to limit very long computations. - Bcrypt is one-way. Password recovery through decryption is not possible, although attackers can still attempt password guesses.
- The algorithm does not replace HTTPS, login rate limiting, secure password reset flows, or multi-factor authentication.
- Hashes must be generated and verified by a trusted backend in production authentication systems. This browser tool is intended for testing and development.
- The bcrypt.js library is fetched from
cdnjs.cloudflare.com. If it cannot load, the page reports an error instead of producing a hash. - For implementation details, see the bcrypt.js documentation.
FAQ
Why does the same password produce a different bcrypt string?
Every generation uses a new random salt. Both outputs can still verify the same password because their salts are included in their respective strings.
Should I save the salt separately?
No. The standard 60-character bcrypt string already contains the salt, cost factor, and hash.
What is a rainbow table attack?
A rainbow table is a precomputed data structure that helps attackers find passwords corresponding to hashes. Unique salts make reusable rainbow tables impractical by requiring salt-specific computations.
Can bcrypt prevent brute-force attacks completely?
No. Bcrypt makes password guesses more computationally expensive, but weak passwords can still be guessed, especially after an attacker obtains stored hashes.
How does verification work if bcrypt produces a different hash every time?
Verification reuses the original salt and cost embedded in the stored bcrypt string instead of generating a new salt.
What cost factor should I choose?
OWASP recommends at least 10 for bcrypt. The appropriate production value depends on your server hardware, authentication traffic, and acceptable verification latency.
Is bcrypt better than SHA-256 for storing passwords?
Yes. Bcrypt includes a configurable computational cost and a salt, making offline password guessing substantially more expensive than using SHA-256 directly.
Should I use bcrypt or Argon2id?
For new applications, Argon2id is generally preferred. Bcrypt remains useful when maintaining existing systems or when Argon2id is unavailable.
Are passwords uploaded or stored?
No. Hashing runs in your browser, and this tool does not send passwords to a backend or save them in browser storage. The page loads bcrypt.js from a third-party CDN, which receives the script request and your IP address, but not your typed password.