Skip to content
Toolcroft

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

4 (fast)14 (slow)

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

  1. Enter a password and choose a cost factor; the default is 12 and higher values take longer.
  2. Click "Hash Password" to generate a bcrypt hash, or cancel the worker while it runs.
  3. Inspect a complete bcrypt hash to view its version, cost, salt, and digest.
  4. 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 factorIterations (2cost)Approx. time (modern server)Recommendation
101,024~100 msLower-cost testing; measure carefully
112,048~200 msCompare against target-system timing
124,096~400 msTool default; benchmark on target system
138,192~800 msUse for sensitive data; may impact UX on slow servers
1416,384~1.6 sVery 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

SegmentValueMeaning
$2b$Algorithm version2b is the current recommended variant
12$Cost factor2¹² = 4,096 rounds
Next 22 charsSaltRandom 128-bit salt, base64 encoded
Remaining 31 charsHash184-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.

Browse all developer tools