Bcrypt Generator

Create bcrypt hashes and check passwords against them — locally.

Runs in your browser Instant No sign-up
Mode
Password
Result

Paste, type or drop a file — output appears as you type.

Waiting for input
Processed locally · nothing is uploadedProcessed locally

How to use it

Hash mode: type a password in the left pane, choose a Cost from 4 to 14 (default 10) and copy the hash. The status line shows the cost, the number of rounds and how long hashing took on your device.

Verify mode: type the password, paste the stored hash into Hash to check, and the result is either ✓ Match or ✗ No match. The tool checks the hash format first: a version prefix of $2a$, $2b$ or $2y$, a two-digit cost, then 53 characters from the bcrypt alphabet ./A-Za-z0-9, for 60 characters in total.

A trailing line break in the editor is ignored, because passwords don’t end with one. Leading or trailing spaces are kept and flagged, because a stray space is a common reason a check fails.

Reading a bcrypt hash

The default sample, correct horse battery staple at cost 10, produced this in one run (yours will differ because the salt is random):

$2b$10$/kUuVdHFIJN0G8Iirb4HGeFdEz8WNshoR/6lITg3ksI0.jKKpzqgO
  • $2b$: the algorithm version.
  • 10: the cost. bcrypt runs 2^10 = 1,024 rounds of its expensive key setup.
  • The next 22 characters (/kUuVdHFIJN0G8Iirb4HGe): the 128-bit salt, in bcrypt’s own Base64 alphabet.
  • The last 31 characters: the 184-bit hash.

Everything a verifier needs is in the string, so you store just this one column in the database.

How long each cost takes

In our tests, this tool hashed the sample in 133 ms at cost 10, 366 ms at cost 12 and 856 ms at cost 13. Your hardware will differ, but the ratio holds: each cost step doubles the time. That is the point of bcrypt. It slows down every guess an attacker makes, but it also slows every login on your server, so measure on production hardware before raising the cost. Hashes record their own cost, so you can raise it later and re-hash each password the next time that user logs in.

Common errors

  • “A bcrypt hash is 60 characters long; this one has 15.” The hash was cut off. A column that is too short (for example VARCHAR(50)) is a classic cause; use CHAR(60) or longer.
  • “This is an Argon2 hash, not bcrypt.” or “This is a crypt(3) SHA-512 hash ($6$)”. The stored hash comes from a different algorithm. The Hash Generator covers plain digests such as SHA-256, which you should not use for passwords.
  • “Cost 15 is too slow to check here”. The browser limit is 14. Check such hashes in your own code.
  • No match, but you are sure the password is right: check for trailing spaces, a different Unicode form (é typed as one character or as e plus an accent), or the 72-byte limit.

Equivalent code

// Node.js (bcrypt or bcryptjs — same API)
import bcrypt from 'bcryptjs';
const hash = await bcrypt.hash(password, 12);
const ok = await bcrypt.compare(password, hash);
import bcrypt
hashed = bcrypt.hashpw(password.encode(), bcrypt.gensalt(rounds=12))
ok = bcrypt.checkpw(password.encode(), hashed)
$hash = password_hash($password, PASSWORD_BCRYPT, ['cost' => 12]); // "$2y$12$…"
$ok = password_verify($password, $hash);

To create strong passwords to hash, use the Password Generator. For two-factor codes on top of passwords, see the TOTP Generator.

Frequently asked questions

Why is the hash different every time for the same password?

bcrypt makes a new random 128-bit salt for every hash and stores it inside the hash string. Two hashes of the same password therefore never look alike, and both still verify. To check a password, use Verify mode (or bcrypt.compare in code). Don't hash the password again and compare the strings.

Which cost should I use?

OWASP recommends a work factor of 10 or more. Pick the highest cost your login server can handle in roughly a quarter of a second per check, often 10 to 12. Every step doubles the time, so cost 13 is about 8× slower than cost 10. The tool goes up to 14 so the browser stays responsive.

What do $2a$, $2b$ and $2y$ mean?

They are version prefixes of the same algorithm. $2y$ comes from PHP's crypt_blowfish fix in 2011, and $2b$ from OpenBSD's fix in 2014 for passwords longer than 255 bytes. For normal passwords all three give the same result, and the tool verifies all three. $2x$ marks hashes made by the buggy pre-2011 code; re-hash those passwords.

Is there a maximum password length?

bcrypt only uses the first 72 bytes of the password (UTF-8 bytes, not characters, so 40 accented letters already exceed it). Many libraries silently ignore the rest; some newer ones throw an error instead. The tool warns when a password is longer than 72 bytes.

Is my password sent anywhere?

No. Hashing and checking run in your browser. The password is never stored as a draft, and the Hash to check field is never saved or put into share links.

Last updated