b2KIT

Bcrypt Hash Generator

Generate bcrypt password hashes with configurable cost factor and verify passwords against existing hashes.

Tested tool guide Tested browser tools Checked August 16, 2026

What Bcrypt Hash Generator does, with a checked example

Bcrypt is a one-way password hash that is deliberately slow: its whole design goal is to make guessing a password from a stolen hash database expensive. This tool runs bcrypt in the browser, so the password never leaves the page: it takes a password and a cost factor, draws a random 16-byte salt, and returns the 60-character hash string you can store. A verify mode checks a candidate password against a hash you already have. Two things surprise most users: hashing the same password twice gives two different hashes, and passwords over 72 bytes are silently cut to their first 72 bytes.

Worked example

A concrete input and expected output from the current implementation.

Input

Password: rasmuslerdorf
Hash: $2y$10$.vGA1O9wmRjrwAVXD98HNOgsNpDczlqm3Jq7KnEd1rVAGv3Fykk1a
(entered in the verify fields)

Expected output

Match: the password 'rasmuslerdorf' verifies against this hash (version $2y$, cost factor 10).

This hash is the canonical test vector from the PHP manual's password_verify example: bcrypt of 'rasmuslerdorf' at cost 10. Verification does not need the original salt - it extracts the salt and cost embedded in the hash and recomputes the digest. Generation cannot have a fixed example, because every run draws a fresh random salt and yields a different hash.

How the result is produced

1

What the hash string contains

A valid bcrypt hash is one 60-character string: a version marker ($2a$, $2b$ or $2y$), a two-digit cost, then 53 characters of bcrypt's base64 encoding holding a 16-byte random salt and a 23-byte digest. The digest comes from expanding the password and salt through 2^cost rounds of the Blowfish key schedule. The verify mode reads the version, cost and salt out of the pasted hash and recomputes the digest.

2

The cost factor

The cost factor sets the work: cost 10 means 2^10 = 1,024 rounds, cost 12 means 4,096, and each increment doubles the time. Cost 10 runs in tens of milliseconds, cost 12 in a few hundred, and you pay this on every login check, not just at generation. The format permits costs 4 to 31, but past about 14 a hash takes seconds, so practical tools stop near there.

Good uses

  • Seeding an account: generate a hash for a new user's or administrator's password and paste it into a database insert, config file, or import script, so no plaintext ever lands in storage.
  • Debugging a login failure: given the hash your application stores and the password a user claims, verify them independently to determine whether the app, the password, or the stored record is the problem.
  • Choosing a production cost: hash the same password at cost 10, 11, and 12, compare the generation times, and pick the highest cost your server can absorb on every login.

Limits and checks

  • Bcrypt silently ignores everything past the first 72 bytes of the password, and bytes, not characters, are counted - a 30-character emoji password can already exceed the limit. Any two passwords sharing those first 72 bytes verify identically, and some libraries reject long inputs instead of truncating, so one credential can behave differently across systems.
  • Generation draws a fresh salt every run, so the same password never produces the same hash twice, and two hashes can never be compared for equality - use the verify mode instead. If the tool ever does return an identical hash, the random source is broken or a salt was reused, and those hashes are not safe.
  • The 53 data characters use bcrypt's own base64 alphabet, not standard base64, so pasting a hash into a normal decoder gives garbage. Copy the whole 60-character string exactly: altering one character, adding a space, or decoding and re-encoding breaks verification, which compares the recomputed digest against the stored one.

Common questions

Can the original password be recovered from a hash?

No. Bcrypt is one-way: the digest cannot be reversed, and the salt embedded in the hash only helps verification, not recovery. The only route back to the password is guessing candidates and checking each one - exactly the attack the cost factor exists to slow down. If the plaintext is lost, it is gone; generate a fresh hash and reset the password.

What cost factor should I use?

Start with the library default - usually 10 or 12 - and measure on your own hardware. The right value is the highest cost that keeps every login check tolerable, typically 100-250 ms. Raising the cost later is safe: verification reads the cost from the stored hash, so old hashes keep verifying while new ones get the stronger setting.

References and verification

The example and behavioral notes were checked against the browser implementation. Standards and primary references below define the relevant format, formula, or platform behavior.

Related Tools