FormatterHQ

Bcrypt Hash Generator

Create a salted bcrypt hash of a password with the cost factor you choose — for seeding test accounts or resetting an admin password in an application you run.

Input TEXT
Output TEXT
Ready.

How to use the Bcrypt Hash Generator

  1. Type the password into the input editor, or click Sample to try it with a test value.
  2. Choose the Cost factor in the options panel — 10 is the classic default, 12 is a common modern choice.
  3. Click Generate hash. A new random salt is used every time.
  4. Copy the 60-character hash from the output panel and store it in your database or seed file.

Bcrypt hash generator for password storage

Bcrypt is a password hashing function designed in 1999 by Niels Provos and David Mazières. Unlike general-purpose hashes such as MD5 or SHA-256, which are built to be fast, a bcrypt hash is deliberately slow and salted, so attackers who steal a database cannot test billions of guesses per second. This generator creates standard $2y$ bcrypt hashes in your browser, ready for PHP, Laravel, Symfony, WordPress plugins, Node.js, Python, Go and most other platforms.

Typical, legitimate uses are seeding test or demo users, writing database fixtures, and resetting the password of an admin account in an application you operate when the normal reset flow is unavailable.

Example

Hashing correct horse battery staple with cost 10 produced:

$2y$10$oQUDqqYCDyDhbXPZRluK8OwRGLK4lYR4ZF4Csglsl4UODRXIvGUFi

Hashing the same password again gives a different string, such as $2y$10$0iNESMe2IAVzDcfSF.kcXufDc.t1.SFj0B8YKf3trBqGKhgqnY6vm. Both are correct: each hash contains its own random salt, and verification reads the salt from the hash.

Anatomy of a bcrypt hash

PartExampleMeaning
Prefix$2y$Algorithm version
Cost10$log₂ of the number of key-expansion rounds (2¹⁰ = 1,024)
SaltoQUDqqYCDyDhbXPZRluK8O22 characters = 128 random bits, in bcrypt’s own Base64 alphabet
HashwRGLK4lYR4ZF4Csglsl4UODRXIvGUFi31 characters = 184 bits of the result

The whole string is always 60 characters long, so a VARCHAR(60) column is enough for bcrypt itself — although many frameworks recommend 255 so you can switch to longer formats such as Argon2 later.

Choosing the cost factor

The cost factor controls how slow each hash is, and each step up doubles the work. On a typical server, cost 10 takes on the order of 50–100 ms per hash, cost 12 about four times as long. Higher cost makes stolen hashes much harder to crack but also makes every login slower and uses more CPU.

  • OWASP’s Password Storage Cheat Sheet recommends a work factor of at least 10 for bcrypt.
  • PHP’s password_hash() used cost 10 by default until PHP 8.4, which raised the default to 12; Laravel’s default is also 12 in recent versions.
  • Aim for a value that takes a few hundred milliseconds at most on your production hardware, and raise it over time as hardware gets faster. Frameworks can rehash on the next successful login.
  • Costs 4–9 are only sensible for automated tests, where speed matters more than strength.

Because this tool runs in your browser, high costs such as 14 can take several seconds on slower devices.

$2a$, $2b$ and $2y$

All three prefixes denote bcrypt. $2a$ is the original. $2y$ was introduced by PHP in 2011 after a bug in one implementation’s handling of non-ASCII characters, to mark hashes from the corrected code; $2b$ is OpenBSD’s 2014 fix for a different bug with very long passwords. For correctly implemented libraries, the three produce the same result, and most verifiers accept all of them. This tool outputs $2y$, the format of PHP’s password_hash().

Limits and good practice

  • 72-byte limit. Bcrypt only uses the first 72 bytes of the password; the rest is ignored. With UTF-8, non-Latin characters take several bytes each, so the limit is reached sooner. Some systems (including WordPress 6.8) pre-hash passwords to work around this.
  • Never use MD5, SHA-1 or plain SHA-256 for passwords. They are far too fast. Bcrypt, Argon2id, scrypt or PBKDF2 with a high iteration count are the appropriate choices; OWASP lists Argon2id first for new systems.
  • Hash on the server in production. Your application should hash passwords with its own library at sign-up and login. Use this tool for fixtures, test data and administrative one-offs.
  • Bcrypt is one-way. A hash cannot be decrypted; it can only be checked against a candidate password.

Privacy

The password and hash are computed locally with WebAssembly and a salt from your browser’s secure random generator; nothing is sent to our server. To test a password against an existing hash, use the Bcrypt Hash Checker. For WordPress sites, the WordPress Password Hash Generator produces the exact format WordPress expects, and the Password Generator can create a strong password to hash.

Frequently asked questions

Why is the bcrypt hash different every time?
Each hash includes a new random 128-bit salt, so the same password produces a different string each time. Verification works because the salt is stored inside the hash.
Can a bcrypt hash be decrypted?
No. Bcrypt is a one-way function. The only way to find the password is to guess candidates and check them, which bcrypt makes deliberately slow.
What cost factor should I use?
At least 10, and 12 is a common modern choice. Pick the highest value your servers can handle while keeping login times acceptable, typically well under a second.
Will the $2y$ hash work outside PHP?
Usually yes. Most bcrypt libraries in Node.js, Python, Go, Java and .NET accept $2y$ hashes; if one only accepts $2a$ or $2b$, changing the prefix is safe for hashes created by correct implementations.
How long can the password be?
Bcrypt uses at most 72 bytes of the password. Characters beyond that limit do not affect the hash.

Last updated October 3, 2026

Related tools

Bcrypt Hash Checker Check whether a password matches a bcrypt hash, like PHP password_verify, entirely in your browser. BLAKE2b Hash Generator Generate BLAKE2b hashes (128–512 bits) with optional keyed MAC mode, from text or files. BLAKE2s Hash Generator Generate BLAKE2s hashes (128–256 bits), the 32-bit-optimised BLAKE2 variant, with optional key. BLAKE3 Hash Generator Generate BLAKE3 hashes from text or files — the fast, parallel successor of BLAKE2. Checksum Calculator Calculate MD5, SHA-1, SHA-256, SHA-512, CRC-32 and more checksums of a file or text at once. CRC-16 Hash Generator Calculate CRC-16 checksums (ARC, MODBUS, CCITT, XMODEM, KERMIT, X-25, USB) for text or files. CRC-32 Hash Generator Generate the CRC-32 hash of any text or file online. Instant 32-bit checksum in hex, computed in your browser. CSR Decoder Decode a PKCS#10 certificate signing request to check the subject, SANs, key size and signature before you send it to a CA. CSR Generator Generate an RSA private key and certificate signing request (CSR) with SANs in your browser — the private key never leaves your device. ECDSA & Ed25519 Key Generator Generate elliptic-curve key pairs (P-256, P-384, P-521) and Ed25519 keys as PEM or JWK for JWT signing, TLS and APIs. Encrypt & Decrypt Text Encrypt or decrypt text with AES, Triple DES, Rabbit, RC4 or Blowfish using a secret passphrase — in your browser. Hash Identifier Identify hash types from their format: MD5, SHA-1/256/512, bcrypt, Argon2, sha512crypt, NTLM, MySQL, phpass, Django and more.