toolqik

31 · Hashing & Passwords

bcrypt Hash Generator

Hash and verify passwords with bcrypt, at any cost factor.

Runs in your browser
bcrypt hash

  

About this tool

bcrypt is a password-hashing function designed to be slow on purpose. Every hash gets its own random salt, and a cost factor controls how much work each hash takes, so even with a stolen database an attacker can only test a small number of guesses per second. It has protected passwords since 1999 and is built into PHP, Spring Security, Rails, Laravel, Django (as an option) and most Node.js and Go apps.

How to use this bcrypt generator

  1. Hash: type a password, choose a cost factor (10–12 is typical) and click Hash password. Copy the 60-character result into your database, seed file or test fixture.
  2. Verify: open the Verify tab, paste an existing bcrypt hash and type a password. The checker tells you whether they match. It accepts $2a$, $2b$ and $2y$ hashes.

Hashes made here are standard bcrypt. We verified that hashes from this tool check out in Python’s bcrypt library and the other way round, and they work with PHP’s password_verify, Spring Security, Go and Node.js libraries.

Anatomy of a bcrypt hash

A bcrypt hash such as $2b$12$bUIidAawuleh26jKw1tV3OpV3kx4c9q0YiV03C1pgjvQoV/bUoWCS stores everything needed to verify it:

PartExampleMeaning
Version$2b$The bcrypt variant. $2a$, $2b$ and $2y$ verify the same way in modern libraries.
Cost12212 = 4,096 rounds of the expensive key setup.
SaltbUIidAawuleh26jKw1tV3O22 characters: a random 128-bit salt, new for every hash.
HashpV3kx4c9q0YiV03C1pgjvQoV/bUoWCS31 characters: the result itself.

That’s why the same password gives a different hash every time, and why you never need to store the salt separately.

Choosing a cost factor

Each +1 doubles the time to compute a hash. OWASP recommends a cost of at least 10. A good rule is the highest cost that keeps a login under about 250 ms on your production server. Many apps use 12. Measure on your own hardware: the timer under the button shows how long your browser took, and servers are usually faster. When you raise the cost later, re-hash each user’s password on their next successful login.

Can you decrypt a bcrypt hash?

No. bcrypt is a one-way function: there’s no key and no way to turn the hash back into the password. Sites that claim to “decrypt bcrypt” are only trying lists of common passwords, which is exactly what bcrypt’s slowness is designed to make expensive. To check whether a password belongs to a hash, use the Verify tab. If you need a strong password to hash, try the password generator.

The 72-byte limit

bcrypt only uses the first 72 bytes of a password and silently ignores the rest. Two long passwords that share the same first 72 bytes produce matching hashes. This tool warns you when your input is longer. Note that non-ASCII characters use 2–4 bytes each in UTF-8. Some libraries, such as Go’s, now reject long passwords instead. If you need long passphrases, cap the length or use Argon2id.

bcrypt vs. Argon2id, scrypt and PBKDF2

For new projects, OWASP’s first choice is Argon2id, which is also memory-hard, making GPU attacks more expensive. bcrypt is still a sound, widely supported choice for existing systems. scrypt is another memory-hard option, and PBKDF2 is mainly used where FIPS compliance is required. Never store passwords with a fast hash like MD5 or plain SHA-256: those are built for speed, which is the opposite of what password storage needs.

Hash and verify bcrypt in code

const bcrypt = require('bcrypt'); // or 'bcryptjs' (pure JS, same API)

const hash = await bcrypt.hash(password, 12);    // "$2b$12$..."
const ok = await bcrypt.compare(password, hash); // true / false

FAQ

Can bcrypt be decrypted?

No. bcrypt is a one-way hash, not encryption. The only way to find the password is to guess candidates and hash each one, which bcrypt makes deliberately slow. To check a password against a hash, use the Verify tab.

Why does the same password give a different hash every time?

bcrypt generates a new random 128-bit salt for every hash and stores it inside the hash string. Verification reads the salt back from the hash, so every version verifies correctly.

What cost factor should I use?

At least 10, as recommended by OWASP, and ideally the highest value that keeps login under about 250 ms on your server. 12 is a common choice today.

What is the difference between $2a$, $2b$ and $2y$?

They are revisions of the bcrypt format created to fix bugs in specific implementations. $2y$ comes from PHP and $2b$ from OpenBSD. Modern libraries generate one of them and verify all three the same way.

Is there a maximum password length?

Yes. bcrypt only uses the first 72 bytes of the input. The tool warns you when your password is longer. For long passphrases, consider Argon2id.

Is bcrypt still secure?

Yes, with a cost of 10 or more it remains a safe choice for password storage. For new systems Argon2id is preferred because it is also memory-hard.

Will these hashes work in PHP, Python, Java or Node.js?

Yes. The tool produces standard $2b$ bcrypt hashes that verify with password_verify in PHP, the bcrypt package in Python, Spring Security’s BCryptPasswordEncoder, Go’s x/crypto/bcrypt and Node’s bcrypt or bcryptjs.

Is it safe to type a real password here?

Hashing happens entirely in your browser and nothing is transmitted. Even so, the safest habit is to test with sample passwords rather than real credentials.

esc
↑↓ navigate↵ open