Bcrypt Hash Generator & Verifier - Client-Side Password Hashing
Developer Tools
Generate and verify bcrypt password hashes in a browser-only worker. Inspect hash fields, check the 72-byte limit, and benchmark costs from 4–14.
Generate Hash
0 / 72 UTF-8 bytes
Default 12 is a starting point; measure on your target server before choosing a production cost.
Sample salt: $2b$12$Qa5HuQw9000JE3CqIrOdce
Verify Password
0 / 72 UTF-8 bytes
Inspect Hash
How to use this tool
- Enter a password and choose a cost factor; the default is 12 and higher values take longer.
- Click "Hash Password" to generate a bcrypt hash, or cancel the worker while it runs.
- Inspect a complete bcrypt hash to view its version, cost, salt, and digest.
- To verify, paste a hash and enter its password, then click "Verify".
How Bcrypt Works
Bcrypt is based on the Blowfish block cipher. During hashing, a random 16-byte salt is generated and the Expensive Key Schedule (EKS) Blowfish setup is run for 2cost key-schedule iterations. The "OrpheanBeholderScryDoubt" magic string is then encrypted 64 times; bcrypt encodes the result as a 31-character digest alongside the salt and cost.
Choosing a Cost Factor
This tool starts at cost 12, which performs 212 (4,096) key-schedule iterations. Higher costs take about twice as long for each step, but elapsed time depends on the device running the tool. Use the displayed browser timing to compare settings, then benchmark separately on the server that will handle real logins; browser timing is not a substitute for measuring your production system.
Cost factor benchmark
The table below shows approximate hashing times on a modern server CPU (single-threaded). Actual times vary by hardware and implementation. The table is a rough comparison only; benchmark on your own server before choosing a value for production.
| Cost factor | Iterations (2cost) | Approx. time (modern server) | Recommendation |
|---|---|---|---|
| 10 | 1,024 | ~100 ms | Lower-cost testing; measure carefully |
| 11 | 2,048 | ~200 ms | Compare against target-system timing |
| 12 | 4,096 | ~400 ms | Tool default; benchmark on target system |
| 13 | 8,192 | ~800 ms | Use for sensitive data; may impact UX on slow servers |
| 14 | 16,384 | ~1.6 s | Very high cost; cancel if this browser is too slow |
Password storage security
Never store plaintext passwords. When a user sets a password, bcrypt hashes it with a random salt before storing. Each bcrypt hash is unique even for identical passwords, so attackers cannot use a single precomputed table (rainbow table) to crack multiple accounts at once. The one-way nature of the hash means the original password cannot be retrieved from the stored value.
Bcrypt processes at most 72 password bytes, not 72 visible characters. This tool counts UTF-8 bytes and warns when an input is longer; bytes beyond that limit are ignored by bcrypt. Two passwords that share their first 72 bytes therefore produce the same bcrypt input, even when their remaining characters differ. Check this limit when debugging passwords that include emoji or other multi-byte characters.
Generated hashes use the $2b$ prefix. The inspector and verifier also accept
$2a$ and $2y$ prefixes, commonly seen in existing application data. A
few older $2a$ implementations handled non-ASCII password bytes differently; if such
a legacy hash fails, confirm it with the library that created it. For new systems, consider Argon2id
where your platform supports it, and use the same password-hashing library and settings in production.
Modern alternatives worth considering:
- Argon2id (winner of the Password Hashing Competition): memory-hard; the current best-practice recommendation for new systems.
- scrypt: also memory-hard; widely supported; used by Litecoin and other systems.
- PBKDF2: FIPS-approved; suitable when regulatory compliance requires it.
Bcrypt hash format
A bcrypt output string looks like:
$2b$12$LQv3c1yqBWVHxkd0LHAkCOYz6TtxMQJqhN8/lfkpwkE
| Segment | Value | Meaning |
|---|---|---|
$2b$ | Algorithm version | 2b is the current recommended variant |
12$ | Cost factor | 2¹² = 4,096 rounds |
| Next 22 chars | Salt | Random 128-bit salt, base64 encoded |
| Remaining 31 chars | Hash | 184-bit output, base64 encoded |
Frequently asked questions
What is the cost factor?
The cost (or work factor) is the log-2 of the number of key expansion rounds. Cost 10 means 2^10 = 1024 rounds. Higher cost makes brute-force attacks slower but also slows hashing.
Is bcrypt safe for password storage?
Bcrypt is widely recommended for password hashing because it is deliberately slow and includes a random salt. Each hash is unique even for identical passwords, preventing rainbow table attacks.
Why is hashing slow in the browser?
Bcrypt is intentionally CPU-intensive. Higher cost factors take longer, and the time depends on your device. This tool runs the calculation in a cancelable Web Worker and reports the measured time for this browser; that measurement is not a server benchmark.
Why does bcrypt have a 72-byte password limit?
Bcrypt processes at most 72 password bytes, measured here as UTF-8. Any remaining bytes are ignored, so passwords with the same first 72 bytes produce the same bcrypt input. The tool shows the byte count before hashing or verification.
Can I verify $2a$, $2b$, and $2y$ hashes?
The inspector and verifier accept $2a$, $2b$, and $2y$ bcrypt prefixes. These labels share the same salt, cost, and digest structure. Some legacy $2a$ implementations handled non-ASCII password bytes differently, so hashes made with that historical behavior may need verification with their originating library.
Related tools
- Password GeneratorUse Password Generator to generate strong random passwords using the Web Crypto.
- Passphrase GeneratorCreate a memorable multi-word password, then test its bcrypt hash in this tool.
- Password StrengthCheck a password’s length and composition before testing its bcrypt hash.
- Hash GeneratorUse Hash Generator to generate MD5, SHA-1, SHA-256, SHA-384, and SHA-512 hashes.