Online Bcrypt Hash Tool: Cost Factors, Salt, and Password Verify
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 has been the industry workhorse for password storage for more than two decades: every major language ships a battle-tested implementation, and the on-disk format encodes algorithm version, cost, and salt in one string.
Unlike regular hashes (e.g., SHA-256), bcrypt is purpose-built for passwords — built-in salt and an adjustable cost factor. Open the Bcrypt Hash tool to generate or verify locally in the browser.
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 |
Tuning target: pick a cost that makes interactive login take ~100–300ms on production hardware. On 2026 laptops that usually lands at 12–13; cost 10 is often too cheap for new systems.
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 password hashes (and vs file hashes)
| Algorithm | Speed | Built-in Salt | Cost Factor | Typical use |
|---|---|---|---|---|
| MD5 | Very fast | ❌ Manual | ❌ | Not for passwords |
| SHA-256 | Fast | ❌ Manual | ❌ | File integrity — see hash verifier |
| Argon2id | Tunable + memory-hard | ✅ Built-in | ✅ | New password stores when libs are solid |
| Bcrypt | Tunable | ✅ Built-in | ✅ | Existing stores; still sound at cost ≥12 |
Do not confuse bcrypt with SHA-256 file checks. Hash verifier answers “did this download match the published digest?”. Bcrypt answers “does this password match the stored credential?”. Feeding a password into SHA-256 (no salt, no cost) is a storage anti-pattern; feeding an ISO into bcrypt is the wrong tool.
Storage habits that survive audits
- Never store plaintext passwords — bcrypt or Argon2id only
- Allow long passwords in the UI — bcrypt truncates at 72 bytes; document the limit and prefer passphrases that stay under it, or pre-hash with SHA-256 only when you fully understand the tradeoffs
- Raise cost over time — compare-and-rewrite on next successful login (cost lives inside the hash string)
- Re-hash on password change — new salt, current cost
- Constant-time compare — use the library’s
compare/timingSafeEqual, never===on hash strings
Password cluster on this site
| Step | Tool / guide |
|---|---|
| Create a random secret | Password generator · generator guide |
| Estimate entropy / reject patterns | Strength checker · strength guide |
| Store / verify at rest | Bcrypt tool · this article |
| Verify a file download | Hash verifier — not bcrypt |
The cost factor: tuning bcrypt's only meaningful dial
bcrypt's cost factor is log2 of the hash iterations: cost 10 = 1024 iterations, cost 12 = 4096, each +1 doubles time. The tuning method nobody should skip: measure on your production hardware — target 100-250ms per hash (user-invisible at login, expensive at scale for an attacker cracking leaked hashes). Cost 10 on a 2026 laptop is ~60ms (too cheap for new systems); cost 12-13 is the current sensible floor; cost 15 on a busy app server starves the thread pool. The migration subtlety: raising the cost silently invalidates nothing (verification reads cost from the hash itself — old hashes verify at old cost), so you can upgrade per-user at next successful login — compare-and-rewrite on login is the standard pattern, no flag day needed.
bcrypt vs Argon2 vs scrypt: the 2026 decision
bcrypt (1999): GPU-resistant via memory usage? No — bcrypt's memory footprint is tiny by modern standards; its resistance comes from age and ubiquity (every platform has a battle-tested implementation). Argon2id (2015, Password Hashing Competition winner): tunable memory + time, actually memory-hard — GPUs and ASICs pay the memory cost; the modern recommendation for new systems when the library support is solid (it now is across the ecosystem). scrypt: the interim memory-hard choice, still sound, between the two in adoption. The decision: existing bcrypt deployments — stay (migration churn beats the marginal gain), verify cost is 12+; new systems — Argon2id with memory set to what your login budget allows (64MB+ class). And the non-choice that is still everywhere: PBKDF2-SHA256 with high iterations — acceptable per NIST, weakest of the three per unit of latency; legacy FIPS-constrained environments only.
Password reset vs password verify: two bcrypt operations, two budgets
The latency budget differs by 100x: interactive login tolerates 250ms (user waits once); bulk verification (importing users, migrating hashes, cracking-adjacent internal audits) at 250ms each means hours for a million rows — parallelize across cores and accept the time, or stage the work. The anti-pattern that surfaces in audits: lowering the cost factor "for the migration script" and forgetting to raise it back — the production hash function now runs at cost 8. Config discipline: one definition of the cost factor, loaded from environment, referenced everywhere; a second hard-coded value in a migration script is a finding waiting to be written.
Implementer's note
This site’s tool uses bcryptjs in the browser: hashSync / compareSync with a rounds slider (4–14 in the UI; high rounds can freeze the tab for seconds — that cost is the point). Production servers should measure cost on their CPU, not on a laptop fan. The 72-byte truncation is a bcrypt algorithm property, not a UI bug — UTF-8 passwords can hit the ceiling earlier than “72 characters”. Versions $2a$ / $2b$ / $2y$ are largely interoperable for verify; generate $2a$/$2b$ from a maintained library and do not hand-edit the prefix.
FAQ
Bcrypt or Argon2id for a greenfield app?
Argon2id won the 2015 Password Hashing Competition and is memory-hard (GPU/ASIC pay for RAM). Bcrypt remains a sound, ubiquitous choice. For greenfield with solid library support, Argon2id is the modern default; existing bcrypt rows do not need a flag-day migration if cost is already ≥12.
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 on production hardware. In 2026 that often means 12–13. Raise gradually via login-time rewrite as machines get faster.
This article is brought to you by ToolVault. More developer tools at the homepage.
Related Tools
Related Articles
Post-Quantum Migration Self-Check: From Algorithm Inventory to Hybrid TLS — 12 Things to Do in 2026
A practical self-check framework for PQC migration: why three overlapping regulatory timelines make 2026 the starting line, how to build a cryptographic bill of materials (CBOM), ranking by HNDL exposure, enabling X25519+ML-KEM hybrid TLS, and what crypto-agility means in practice. With a 12-item checklist.
Passkeys, Explained: Why the Server Can No Longer Hold a Copy of Your Password
Passkeys (WebAuthn/FIDO2) deepened: registration vs assertion ceremonies, platform authenticators and roaming keys, synced passkeys, how they relate to passwords/TOTP/JWT, and why origin binding makes phishing resistance structural. Servers store public keys only; note that this site has no dedicated Passkey tool page.
ML-KEM, Explained: How Kyber Got Into Your TLS Handshake
An engineering tour of ML-KEM (FIPS 203, formerly Kyber): Kyber-to-standard naming, encapsulate/decapsulate and IND-CCA, the three parameter sizes, how X25519+ML-KEM feeds the TLS 1.3 HKDF schedule, the ClientHello-bloat middlebox trap, OpenSSL 3.5 / nginx enablement, and browser-side implementation boundaries.