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.

  1. Enter password: Type password to hash: mySecurePassword123. Or generate random password (8-20 chars, special characters). Input shown in password field (hidden dots).
  2. 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).
  3. Generate hash: Click Generate to create bcrypt hash: $2a$12$N9qo8uLOickgx2ZMRZoMyeIjZAgcfl7p92ldGxad68LJZdL17lhWy. Hash length: 60 chars. Copy for storage in database.
  4. View hash breakdown: Tool shows: algorithm ($2a = bcrypt), cost ($12 = 2^12 iterations), salt (22 chars), hash (31 chars). Understand hash structure.
  5. 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).
  6. Copy hash: Click Copy to copy hash. Store in database: users table, password column (VARCHAR(60)). Never store plaintext password.
  7. 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$A9z8y7x6w5v4u3t2s1r0q9p8o7n6m5l4k3j2i1h0g9f8e7d6c5b4a3

Same 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 14
Cost 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

) || password.startsWith('$2b )) { /* already hash, don't re-hash */ }. Only hash plaintext passwords. Store hash once.

Using bcrypt synchronously in production (blocks event loop)

Why it happens: Node.js bcrypt.hashSync() blocks event loop (CPU-intensive). Cost 12 = 300ms blocked (server unresponsive). Multiple concurrent requests = server hang. Always use async: bcrypt.hash() with await.

How to avoid it: Async: const hash = await bcrypt.hash(password, 12) (non-blocking). Never: const hash = bcrypt.hashSync(password, 12) in production. Sync OK for scripts, CLI tools (not web servers).

Frequently asked questions

What is the difference between bcrypt and MD5/SHA1?

MD5/SHA1 = fast (designed for speed, billions hashes/sec on GPU). Bcrypt = slow (designed to be slow, cost factor tunable). MD5/SHA1 no salt (rainbow tables work). Bcrypt salted (rainbow tables useless). Use bcrypt for passwords.

What cost factor (rounds) should I use for bcrypt?

Cost 12 recommended (OWASP, ~300ms). Cost 10 = too fast (testing only). Cost 14+ = high security (sensitive data). Test on your hardware (target: 250-500ms). Increase cost over time as CPUs get faster.

Can I decrypt a bcrypt hash to get the original password?

No, bcrypt is one-way (hash, not encryption). Cannot reverse hash → password. Only verify: compare plaintext password with hash (bcrypt.compare). If password forgotten, reset only (generate new hash).

Why do I get different hashes for the same password?

Bcrypt generates random salt per hash. Same password → different hash each time. This is correct (prevents rainbow tables). Verification still works (bcrypt extracts salt from hash, re-hashes with same salt).

What is the difference between $2a, $2b, and $2y?

$2a = original (1999). $2b = fixed bug (2014, recommended). $2y = PHP-specific (same as $2b). Use $2b for new hashes. $2a hashes still valid (backward compatible). $2x broken (never use).

Is bcrypt better than Argon2 or scrypt?

Argon2 = newer (2015 Password Hashing Competition winner), memory-hard (GPU/ASIC resistant). Scrypt = memory-hard (Litecoin). Bcrypt = battle-tested (1999), widely supported. All secure. Argon2 = best for new projects, bcrypt = proven, widely available.

How do I migrate from MD5 to bcrypt?

On next login: check if hash is MD5 (length 32), verify with MD5, if correct, re-hash with bcrypt, update database. Gradual migration (only active users). Or force password reset (email all users, re-hash on reset).

References

Privacy and availability