Online Bcrypt Hash Tool: The Gold Standard for Password Hashing
What Is Bcrypt
Bcrypt is a password hashing function based on the Blowfish cipher, designed by Niels Provos and David Mazières in 1999. It's widely regarded as the gold standard for password hashing and is used across the industry for password storage.
Unlike regular hashes (e.g., SHA-256), Bcrypt is purpose-built for password storage with built-in salt generation and adjustable cost factors. Ready to hash or verify a password? Try our free Bcrypt Hash generator — it runs entirely in your browser with adjustable cost factors.
Why You Need Bcrypt
- Resists brute force: Adjustable computation cost makes brute-forcing impractical
- Built-in salt: Automatically generates a random salt per hash, preventing rainbow table attacks
- Tunable cost factor: Increase computation cost as hardware improves
- Time-cost tradeoff: Legitimate logins take milliseconds, but attackers trying billions of passwords would take centuries
Bcrypt Hash Format
The Bcrypt hash format is:
$2a$10$N9qo8uLOickgx2ZMRZoMyeIjZAgcfl7p92ldGxad68LJZdL17lhWy
│ │ │ └─────────────────────────────────── 22-char salt
│ │ └────────────────────────────────────── 31-char hash
│ └───────────────────────────────────────── Cost factor (cost=10)
└──────────────────────────────────────────── Algorithm version (2a)
| Part | Description |
|------|-------------|
| $2a$ | Algorithm version (2a / 2b / 2y) |
| $10$ | Cost factor (2^10 = 1024 iterations) |
| N9qo8uLOickgx2ZMRZoMye | 22-character salt |
| IjZAgcfl7p92ldGxad68LJZdL17lhWy | 31-character hash |
Cost Factor
The cost factor determines Bcrypt's computation cost as a power of 2:
| Cost Factor | Iterations | Approximate Time (2024 hardware) | |-------------|-----------|--------------------------------| | 8 | 256 | ~30ms | | 10 | 1,024 | ~100ms | | 12 | 4,096 | ~300ms | | 14 | 16,384 | ~1.2s |
Recommendation: Choose a cost factor that makes user login take ~100-300ms. Current best practice: 10-12.
How to Use an Online Bcrypt Hash Tool
Using ToolVault's Bcrypt Hash Tool:
Generate Hash
- Enter the plaintext password
- Select a cost factor (default 10)
- Click Hash
- Copy the resulting Bcrypt hash
Verify Password
- Enter the Bcrypt hash
- Enter the password to verify
- Click Verify
- The tool indicates whether the password matches
Code Examples
Node.js
const bcrypt = require('bcrypt');
// Generate hash
const hash = await bcrypt.hash('myPassword123', 10);
// '$2a$10$N9qo8uLOickgx2ZMRZoMye...'
// Verify password
const isMatch = await bcrypt.compare('myPassword123', hash);
// true
Python
import bcrypt
# Generate hash
password = b'myPassword123'
hashed = bcrypt.hashpw(password, bcrypt.gensalt(rounds=10))
# Verify password
is_match = bcrypt.checkpw(password, hashed)
# True
Go
import "golang.org/x/crypto/bcrypt"
// Generate hash
hash, err := bcrypt.GenerateFromPassword([]byte("myPassword123"), 10)
// Verify password
err = bcrypt.CompareHashAndPassword(hash, []byte("myPassword123"))
// nil if match
Bcrypt vs Other Hash Algorithms
| Algorithm | Speed | Built-in Salt | Cost Factor | Recommendation | |-----------|-------|---------------|-------------|----------------| | MD5 | Very fast | ❌ Manual | ❌ | ❌ Not recommended | | SHA-256 | Fast | ❌ Manual | ❌ | ❌ Not recommended | | Argon2 | Tunable | ✅ Built-in | ✅ | ✅ First choice for new projects | | Bcrypt | Tunable | ✅ Built-in | ✅ | ✅ Battle-tested, reliable |
Security Best Practices
- Never store plaintext passwords: Use Bcrypt or Argon2
- Don't limit password length: Bcrypt truncates at 72 bytes, but allow longer input
- Increase cost factor periodically: As hardware improves, raise the cost
- Re-hash on password change: Generate fresh hashes when users update passwords
- Use constant-time comparison: Use
timingSafeEqualto prevent timing attacks
FAQ
Which Is Better, Bcrypt or Argon2?
Argon2 won the 2015 Password Hashing Competition and is theoretically more secure (resists GPU/ASIC attacks). However, Bcrypt has 25+ years of battle-testing. Use Argon2 for new projects; no need to migrate existing Bcrypt implementations.
Why Does Bcrypt Produce Different Hashes Each Time?
Bcrypt automatically generates a random salt per hash. Even with the same input password, the output hash differs. Verification works by re-computing with the stored salt.
What Cost Factor Should I Choose?
Pick a value that makes user login take 100-300ms. In 2024, 10-12 is recommended. As hardware improves, this may need to increase.
This article is brought to you by ToolVault. More developer tools at the homepage.
Related Tools
Related Articles
SHA256 vs MD5: What Is the Difference and Which to Use?
SHA256 vs MD5 difference, why MD5 is no longer safe, and which hash to use for file verification? Compares length, security, and use cases, with our SHA256/MD5 tools.
Can MD5 Be "Decrypted"? What Is a Collision?
People say "MD5 decrypt" — can MD5 actually recover the original? What is a collision attack and why is it dangerous? Clears the misconceptions, with our MD5 / SHA256 tools.
How to Verify File or Text Hashes Match (SHA-256 Comparison for Integrity)
Downloaded a file—how do you know it wasn't tampered with? Learn how hash verification works and step-by-step how to compare SHA-256/MD5 locally to confirm integrity.