Bcrypt Generator

Published Updated

Hash a password with bcrypt at a cost from 4 to 15, or check a password against a hash you already have. Each step up doubles the time: 72 ms at the default of 10 and 2.3 seconds at 15 in a Chrome test.

What each cost step costs

The slider sets the cost, and each step up doubles the work. Measured with bcryptjs 3.0.3 in Google Chrome 156 on one Mac, hashing a 21-character password:

CostTimeNote
47 msLowest allowed; test data only
820 ms
1072 msDefault, and OWASP's floor
12287 ms
141.14 s
152.27 sHighest on the slider

The library yields to the browser between rounds, so the tab stays responsive even at 15. Raising the cost by 1 for a login system makes every sign-in twice as slow, and every attacker guess too.

Anatomy of a hash

Every output is 60 characters: a prefix such as $2b$10$, then a 22-character salt, then a 31-character digest. This tool writes $2b$, the current revision. The designers, Provos and Mazières, built it around a deliberately expensive key schedule so that its cost can rise as hardware improves.

Making and checking a hash

  1. Step 1

    Type the password

    The eye icon shows the text. A notice appears once the password passes 72 bytes.

  2. Step 2

    Set the cost and generate

    Drag the slider from 4 to 15 and press Generate Hash. The page stays responsive even at the slow end.

  3. Step 3

    Copy, or switch to Verify

    Copy the 60-character hash. In Verify mode, paste a hash and the password to learn whether they match.

Edge cases measured

  • 72 bytes, not characters. A key emoji takes 4 bytes, so 18 of them fill the limit and a 19th triggers the warning.
  • Verify checks the shape first. An empty, short or garbled hash gets "doesn't look like a valid bcrypt hash", not a false mismatch. Spaces around a pasted hash are trimmed.
  • Cost is limited to 4 through 15 in Generate but a pasted hash may carry any cost from 4 to 31, and a high one takes correspondingly long to check.
  • Not for fast hashing. For file checksums use Hash Generator; for strong secrets try Passphrase Generator.

Bcrypt questions

Which cost should I choose?

OWASP asks for 10 or more when bcrypt is used. Beyond that, time it on the machine that will check logins. The figures on this page come from one Mac in Chrome, and a server will differ.

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

A fresh random 22-character salt is made on each run and stored inside the hash. Two hashes of one password therefore never match as text. Verify mode reads the salt back out and recomputes.

Can I verify hashes made by PHP, Python or Node?

Hashes that begin with $2a$, $2b$ or $2y$ verified in testing. One starting $2x$ passes the shape check but is rejected by the library, and the page says it does not look valid.

Is bcrypt the best choice for a new system?

OWASP lists Argon2id first, scrypt second, and describes bcrypt as the option for legacy systems. If your framework offers Argon2id, start there.

Why is my long passphrase cut short?

bcrypt reads only the first 72 bytes of a password. A 73-character password matched the hash of its first 72, and so did an 80-character one. The page shows a warning as soon as the limit is passed.

Should I enter a real password here?

The hashing happens inside the page and no request carries the password. Even so, a live account password belongs only in your own application code, so use a throwaway to test.

Related Tools