Bcrypt Hash Generator

Hash one or more passwords with bcrypt, choosing the cost factor and the $2a or $2b prefix. The hashing runs in your browser.

Use the tool

Why this tool exists

Developers need bcrypt hashes to seed a user table, test a login flow, write a fixture or compare against another library's output. Running a script for each one is tedious, and pasting a real password into a random website that hashes it server-side is exactly what you should avoid.

This generator computes the hash on your device. Enter several passwords, one per line, and each gets its own random salt. The cost factor controls the work: each step doubles the time, and cost 12 takes around a second in a browser. Bcrypt only uses the first 72 bytes of a password, so longer inputs are effectively truncated. For testing you can supply a fixed 22-character salt to get repeatable output. Use test passwords, not live production credentials.

How to use it

  1. Enter passwords, one per line.
  2. Choose the cost, from 4 to 14, and the prefix 2b or 2a.
  3. Optionally enter a fixed 22-character salt for repeatable test output.
  4. Run the tool and copy the hashes.

Frequently asked questions

Which cost should I choose?

Pick the highest cost your servers can afford while keeping login fast, often 10 to 12 today. Browser timings differ from servers, so measure on your own hardware. Costs below 10 are for tests only.

Why is a long password truncated?

Bcrypt reads only the first 72 bytes of the input, a limit of the algorithm. Characters beyond that are ignored, so two long passwords with the same first 72 bytes produce the same hash.

Can I use this for real passwords?

The hashing is local, but do not paste live production passwords into any web page you do not fully control. Use it for test data, learning and checking compatibility.

What are the 2a and 2b prefixes?

They mark versions of the bcrypt scheme. 2b is the current one and fixes a bug in some older implementations that affected long inputs. Most libraries accept both when verifying.