BCrypt Generator — Free Online Tool
Generate bcrypt hashes for passwords. Verify bcrypt hashes. Configure salt rounds (cost factor 10-12). Secure password hashing for authentication, Node.js, PHP.
Use this free online BCrypt Generator directly in your browser. No signup required, no data leaves your device. Part of Utilier — a collection of 133+ developer utilities.
What is Bcrypt Hash Generator & Password Verifier (Salt Rounds, Cost Factor)?
Bcrypt hash generator creates secure password hashes using bcrypt algorithm (Blowfish cipher-based). Bcrypt adds salt (random data) + cost factor (iterations: 2^rounds) to make hashing slow (prevents brute-force attacks). Hash format: $2a$10$N9qo8uLOickgx2ZMRZoMyeIjZAgcfl7p92ldGxad68LJZdL17lhWy (algorithm $2a, cost $10, salt 22 chars, hash 31 chars). Configure: salt rounds (10 = fast, 12 = recommended, 14+ = very slow), compare password with hash (verify login). Useful for: user authentication (store hashed passwords, not plaintext), Node.js apps (bcrypt npm package), PHP (password_hash), Django/Rails (default password hashing), securing databases (passwords unreadable if leaked). Tool generates bcrypt hash instantly, verifies password against hash (login simulation), explains hash format (algorithm, cost, salt, hash).
- Bcrypt algorithm: Based on Blowfish cipher (symmetric-key encryption). Uses Eksblowfish (expensive key setup: 2^cost iterations). Slow by design (not GPU-parallelizable). Resistant to rainbow tables (salt), brute-force (cost factor).
- Salt rounds (cost factor): Determines iterations: rounds = 10 → 2^10 = 1024 iterations. Higher = slower, more secure. Recommended: 12 (balance security/speed). Future-proof: increase rounds as CPUs get faster (Moore's Law).
- Hash format: $2a$10$N9qo8uLOickgx2ZMRZoMyeIjZAgcfl7p92ldGxad68LJZdL17lhWy. Parts: $2a (algorithm version), $10 (cost), $N9qo...Mye (22-char base64 salt), IjZ...hWy (31-char base64 hash).
- Password verification: Compare plaintext password with stored hash. Bcrypt extracts salt from hash, re-hashes password with same salt, compares results. Match = correct password. Timing-safe comparison (prevents timing attacks).
- Security advantages: Salted (unique hash per password, prevents rainbow tables). Slow (cost factor prevents brute-force). Adaptive (increase rounds over time). Timing-safe comparison (prevents side-channel attacks).
Why use bcrypt generator?
Storing plaintext passwords = security disaster (database leak exposes all passwords). Bcrypt hashes passwords securely (even if leaked, unreadable).
- Prevent rainbow table attacks: Rainbow table: precomputed hash → password lookup (cracks MD5/SHA1 instantly). Bcrypt adds unique salt per password (rainbow tables useless). Same password = different hash.
- Slow hashing (brute-force protection): MD5/SHA1 = fast (billions hashes/sec on GPU). Bcrypt = slow (cost 12 = ~300ms per hash on CPU). Brute-force 8-char password: bcrypt = years, MD5 = hours. Cost factor tunable.
- Industry standard: Used by: Django (default), Rails (default), Node.js (bcrypt package), PHP (password_hash), OWASP recommended. Battle-tested since 1999. Proven secure.
- Future-proof: CPUs get faster (Moore's Law) → increase cost factor (rounds 10 → 12 → 14). Bcrypt remains secure as hardware improves. MD5/SHA1 = no tunable cost (outdated).
- Compliance: PCI DSS, HIPAA, SOC2 require strong password hashing. Bcrypt meets compliance (salted, slow, adaptive). Plaintext or MD5 = compliance violation.
- Easy to use: Node.js: bcrypt.hash(password, 12). PHP: password_hash($password, PASSWORD_BCRYPT, ['cost' => 12]). No need to manage salt (auto-generated). Verification: bcrypt.compare(password, hash).
When to use bcrypt generator
Use bcrypt whenever you store user passwords (authentication, registration).
- User registration (hash password before storing in database).
- Login verification (compare input password with stored hash).
- Password reset (generate new hash when password changed).
- API authentication (hash API keys, tokens for storage).
- Migrating from MD5/SHA1 (re-hash passwords with bcrypt).
- Learning password security (understand hashing, salting, cost factor).
- Testing bcrypt implementation (verify hash format, cost factor).
- Compliance audits (demonstrate secure password storage for PCI DSS, HIPAA).
How to use bcrypt generator
Enter password, select cost factor, generate hash, verify.
- Enter password: Type password to hash: mySecurePassword123. Or generate random password (8-20 chars, special characters). Input shown in password field (hidden dots).
- Select cost factor (rounds): Choose salt rounds: 10 (fast, ~100ms), 12 (recommended, ~300ms), 14 (very secure, ~1200ms). Higher = slower, more secure. Default: 12 (OWASP recommended).
- Generate hash: Click Generate to create bcrypt hash: $2a$12$N9qo8uLOickgx2ZMRZoMyeIjZAgcfl7p92ldGxad68LJZdL17lhWy. Hash length: 60 chars. Copy for storage in database.
- View hash breakdown: Tool shows: algorithm ($2a = bcrypt), cost ($12 = 2^12 iterations), salt (22 chars), hash (31 chars). Understand hash structure.
- Verify password (optional): Enter password + hash to verify. Tool compares: extracts salt from hash, re-hashes password, checks match. Result: ✓ Match (correct password) or ✗ No match (wrong password).
- Copy hash: Click Copy to copy hash. Store in database: users table, password column (VARCHAR(60)). Never store plaintext password.
- Test in code: Node.js: bcrypt.compare('password', hash). PHP: password_verify($password, $hash). Python: bcrypt.checkpw(password, hash). Use tool to test hashes before production.
Key features
- Secure hash generation: Bcrypt algorithm with salt + cost factor. Generates 60-char hash: $2a$12$... Random salt per password (no collisions).
- Configurable cost: Salt rounds: 10 (fast), 12 (recommended), 14+ (high security). Higher cost = slower (brute-force protection). Adjust based on hardware.
- Password verification: Compare password with hash (login simulation). Timing-safe comparison (prevents timing attacks). Shows match/no match result.
- Hash breakdown: Explains hash format: algorithm ($2a, $2b, $2y), cost ($10-$14), salt (22 chars base64), hash (31 chars base64). Educational.
- Random password generator: Generate secure random password (8-20 chars, uppercase, lowercase, numbers, symbols). Use for testing, password resets.
- Multiple algorithm versions: Supports $2a (original), $2b (fixed bug), $2y (PHP-specific). $2b recommended (latest, most secure). Backward compatible.
- Offline hashing: Client-side bcrypt (JavaScript bcrypt.js library). No server upload. Fast, private, works offline.
Common use cases
- User registration (Node.js): const bcrypt = require('bcrypt'); const hash = await bcrypt.hash(password, 12); // Store hash in DB: INSERT INTO users (email, password) VALUES ('user@example.com', hash).
- Login verification (Node.js): const hash = getUserPasswordFromDB(email); const match = await bcrypt.compare(password, hash); if (match) { loginSuccess(); } else { loginFailed(); }.
- PHP password hashing: $hash = password_hash($password, PASSWORD_BCRYPT, ['cost' => 12]); // Store $hash in database. Verify: password_verify($password, $hash) → true/false.
- Django authentication: Django uses bcrypt by default (PBKDF2-SHA256 alternative). In settings.py: PASSWORD_HASHERS = ['django.contrib.auth.hashers.BCryptSHA256PasswordHasher']. Auto-hashes on user.set_password().
- API key storage: Hash API keys before storage: apiKeyHash = bcrypt.hash(apiKey, 12). Store hash, not plaintext. Verification: bcrypt.compare(providedKey, storedHash). Prevents key leak.
- Migration from MD5: Replace MD5 hashes with bcrypt: on next login, check if hash is MD5 (length 32), verify with MD5, re-hash with bcrypt, update database. Gradual migration.
Examples
Bcrypt hash generation and verification examples.
Generate hash (cost 12)
Password: mySecurePassword123, Cost: 12$2b$12$N9qo8uLOickgx2ZMRZoMyeIjZAgcfl7p92ldGxad68LJZdL17lhWy$2b (algorithm), $12 (cost = 2^12 = 4096 iterations), N9qo...Mye (salt), IjZ...hWy (hash). Same password, different hash each time (random salt).
Verify password (correct)
Password: mySecurePassword123, Hash: $2b$12$N9qo8uLOickgx2ZMRZoMyeIjZAgcfl7p92ldGxad68LJZdL17lhWy✓ Password matches hash (authentication successful)Bcrypt extracts salt from hash, re-hashes password with same salt, compares results. Match = correct password.
Verify password (incorrect)
Password: wrongPassword, Hash: $2b$12$N9qo8uLOickgx2ZMRZoMyeIjZAgcfl7p92ldGxad68LJZdL17lhWy✗ Password does not match hash (authentication failed)Re-hashed password with extracted salt. Hash different from stored hash = wrong password. Timing-safe comparison (no timing leak).
Different salts (same password)
Password: password123 (hashed twice)Hash 1: $2b$12$X1a2b3c4d5e6f7g8h9i0j1k2l3m4n5o6p7q8r9s0t1u2v3w4x5y6z7
Hash 2: $2b$12$A9z8y7x6w5v4u3t2s1r0q9p8o7n6m5l4k3j2i1h0g9f8e7d6c5b4a3Same password → different hash (random salt). Prevents rainbow tables (can't precompute hashes). Each hash unique.
Cost factor comparison
Password: test123, Cost: 10 vs 12 vs 14Cost 10: ~100ms (fast)
Cost 12: ~300ms (recommended)
Cost 14: ~1200ms (very secure)Higher cost = slower hashing (brute-force protection). 2x cost = 4x time (exponential: 2^cost). Choose based on security needs + server load.
Technical reference
Bcrypt technical details (algorithm, format, cost):
- Hash format
- $2a$10$N9qo8uLOickgx2ZMRZoMyeIjZAgcfl7p92ldGxad68LJZdL17lhWy. Length: 60 chars. Parts: $2a (algorithm), $10 (cost), $N9qo...Mye (salt, 22 chars), IjZ...hWy (hash, 31 chars). Base64 encoding (not standard base64: uses ./ instead of +/).
- Algorithm versions
- $2a (original, 1999), $2b (fixed bug in 2014, recommended), $2y (PHP-specific, same as $2b), $2x (broken, do not use). Use $2b for new hashes. $2a backward compatible.
- Cost factor (rounds)
- Range: 4-31 (2^4 to 2^31 iterations). Recommended: 12 (2^12 = 4096 iterations, ~300ms). Higher = slower: 10 (~100ms), 12 (~300ms), 14 (~1200ms), 16 (~5sec). Increase as CPUs get faster.
- Salt
- Random data (128 bits = 16 bytes). Encoded as 22-char base64. Generated automatically (no manual salt needed). Unique per password (prevents rainbow tables). Stored in hash (first 29 chars: $2a$10$...).
- Hash output
- Derived from password + salt via Eksblowfish (expensive key setup). Output: 184 bits = 23 bytes. Encoded as 31-char base64. Stored in hash (last 31 chars: ...ldGxad68LJZdL17lhWy).
- Iterations
- 2^cost. Cost 10 = 1024 iterations, cost 12 = 4096 iterations, cost 14 = 16384 iterations. Each iteration: Blowfish key expansion (expensive). Prevents brute-force (slow hashing).
- Hash time
- Cost 10: ~100ms (fast, testing). Cost 12: ~250-350ms (recommended, production). Cost 14: ~1-1.5sec (high security, sensitive data). Time depends on CPU (adjust cost based on hardware).
- Comparison
- Bcrypt vs MD5: bcrypt = slow (cost 12 = 300ms), salted. MD5 = fast (microseconds), no salt (rainbow table vulnerable). Bcrypt vs Argon2: Argon2 = newer (2015), memory-hard (GPU-resistant). Bcrypt = battle-tested, widely supported.
- Database storage
- VARCHAR(60) or CHAR(60) (hash length always 60). Example: CREATE TABLE users (id INT, email VARCHAR(255), password VARCHAR(60)). Never VARCHAR(255) for plaintext (security red flag).
- Security
- Rainbow tables: ✗ (salted). Brute-force: ✗ (slow, cost factor). GPU cracking: ✗ (not parallelizable like SHA). Timing attacks: ✗ (timing-safe comparison). Quantum computers: ✗ (Grover's algorithm = 2^(n/2), still secure with high cost).
Common mistakes to avoid
Storing bcrypt hash in VARCHAR(32) or VARCHAR(50) (truncates hash)
Why it happens: Bcrypt hash = 60 chars. VARCHAR(32) truncates to 32 chars (hash corrupted, verification always fails). VARCHAR(50) truncates to 50 chars (still broken). Common mistake from MD5 (32 chars).
How to avoid it: Use VARCHAR(60) or CHAR(60). CREATE TABLE users (password VARCHAR(60)). Check existing tables: ALTER TABLE users MODIFY password VARCHAR(60) (MySQL). Truncated hashes unrecoverable (users locked out).
Using low cost factor (rounds 4-8, too fast for brute-force protection)
Why it happens: Cost 4 = 16 iterations (~1ms, no brute-force protection). Cost 8 = 256 iterations (~10ms, still too fast). GPUs can crack low-cost bcrypt (billions attempts/sec). Security illusion (looks secure, actually weak).
How to avoid it: Use cost 12 minimum (OWASP recommendation). Cost 14+ for sensitive data (financial, health). Test hash time (target: 250-500ms). Never use cost < 10 in production.
Comparing hashes with == or === (timing attack vulnerability)
Why it happens: String comparison == returns early on first mismatch (timing leak). Attacker measures time, deduces hash char-by-char. Bcrypt.compare() uses timing-safe comparison (constant time, no leak).
How to avoid it: Never compare: if (hash === storedHash). Always use: bcrypt.compare(password, hash) (Node.js), password_verify($password, $hash) (PHP). Timing-safe comparison prevents side-channel attacks.
Re-hashing bcrypt hash (double hashing, breaks verification)
Why it happens: Hash already hashed = double hash: bcrypt.hash(existingHash, 12). Verification fails (comparing password with double hash, not original hash). Common when migrating or refactoring code.
How to avoid it: Check if already hashed: if (password.startsWith('$2a