Bcrypt Generator & Verifier
Generate bcrypt password hashes with configurable cost factor, or verify a password against an existing bcrypt hash. Free, secure, and open.
Bcrypt Hash
Algorithm
—
Cost Factor
—
Rounds
—
Time
—
Salt (22 chars)
—
Hash Body (31 chars)
—
Enter a password and click Generate to create a bcrypt hash
Algorithm
—
Cost Factor
—
Rounds
—
Paste a bcrypt hash and enter a password to verify
Recommended: 10–12 for most applications. Each +1 doubles computation time.
What is Bcrypt?
Bcrypt is a password hashing function designed by Niels Provos and David Mazières in 1999, based on the Blowfish cipher. Unlike fast hash functions like MD5 or SHA256, bcrypt is intentionally slow — making brute-force attacks computationally expensive and impractical.
Bcrypt automatically generates and incorporates a random salt, preventing rainbow table attacks. Its adaptive cost factor allows you to increase the work required as hardware gets faster, keeping your password storage secure over time.
Bcrypt Hash Structure
A bcrypt hash is always 60 characters long and follows this format:
$2b$
Algorithm identifier. $2b$ is the current standard. $2a$ and $2y$ are older variants.
12$
Cost factor (log2 of iterations). Cost 12 = 212 = 4,096 rounds of the key expansion.
Salt (22 chars)
128-bit random salt encoded in a custom base64 alphabet. Automatically generated — unique per hash.
Hash (31 chars)
184-bit hash result encoded in the same base64 alphabet. Derived from the password, salt, and cost factor.
Choosing the Right Cost Factor
The cost factor controls how many rounds of key expansion bcrypt performs. Each increment doubles the computation time:
| Cost | Rounds | Approx. Time | Use Case |
|---|---|---|---|
| 4 | 16 | ~1ms | Testing only |
| 10 | 1,024 | ~65ms | Standard web apps |
| 12 | 4,096 | ~250ms | Recommended default |
| 14 | 16,384 | ~1s | High-security apps |
| 17 | 131,072 | ~8s | Maximum security |
Rule of thumb: Choose the highest cost factor that keeps hash generation under 250–500ms on your production hardware. Re-evaluate annually as CPUs get faster.
Bcrypt vs Other Hashing Algorithms
| Feature | Bcrypt | MD5/SHA | Argon2 |
|---|---|---|---|
| Purpose | Password hashing | General hashing | Password hashing |
| Built-in salt | ✓ Yes | ✗ No | ✓ Yes |
| Adaptive cost | ✓ CPU time | ✗ No | ✓ CPU + memory |
| Brute-force resistant | ✓ Very | ✗ Weak | ✓ Very |
| Industry adoption | Very high | Legacy only | Growing |
Security Best Practices
- Never store passwords in plain text. Always hash with bcrypt or a similar adaptive function.
- Don't use MD5 or SHA for passwords. They're too fast — attackers can try billions of guesses per second.
- Don't invent your own salt logic. Bcrypt generates and embeds a cryptographically random salt automatically.
- Increase cost factor over time. As hardware improves, bump up the cost factor and rehash on next login.
- 72-byte limit. Bcrypt only processes the first 72 bytes of input. For longer passwords, pre-hash with SHA256 first.
- Use constant-time comparison. When verifying, always use
password_verify()(PHP) or equivalent — never compare hash strings directly.