Home › Developer Tools › Bcrypt Hash Generator & Checker

Bcrypt Hash Generator & Checker

Create a salted bcrypt hash for a password with the cost factor you choose, or paste an existing hash to check whether a password matches it. Hashing runs on your device and the password never leaves the page.

Last updated:

Loading bcrypt engine…

Estimated time: measuring…
Prefix
Advertisement
Advertisement

How to use the Bcrypt Hash Generator & Checker

  1. Generate tab: type the password and choose a cost factor. 10 to 12 is typical for web logins.
  2. Pick the prefix: $2b$ is the current standard, $2a$ suits older libraries and $2y$ is what PHP's password_hash() writes.
  3. Press Generate hash and copy the 60-character result into your database or config.
  4. Verify tab: paste a bcrypt hash and type a password, then press Verify password to see whether they match.
  5. Check the breakdown under the hash to see its version, cost and salt.

Why bcrypt instead of MD5 or SHA-256 for passwords?

General-purpose hash functions such as MD5 and SHA-256 are designed to be fast. That is perfect for checksums, but terrible for passwords: a single modern GPU can try billions of MD5 or SHA-256 guesses per second, so a leaked table of unsalted hashes falls to dictionary attacks within hours. Identical passwords also produce identical hashes, which reveals reused passwords and makes precomputed rainbow tables effective.

bcrypt, designed by Niels Provos and David Mazières in 1999, fixes both problems:

  • Salted: every hash contains its own random 16-byte salt, so the same password never gives the same hash twice and precomputed tables are useless.
  • Slow on purpose: the cost factor sets the number of key-expansion rounds to 2cost. Raising the cost by one doubles the work, so you can keep pace with faster hardware simply by increasing it.
  • Memory-hungry enough to annoy GPUs: the Blowfish state (4 KB of S-boxes) is constantly rewritten, which makes bcrypt much less efficient on GPUs than plain SHA-256.

Anatomy of a bcrypt hash

A bcrypt string is always 60 characters. For example, the password password hashed with cost 10 and the salt below gives $2b$10$N9qo8uLOickgx2ZMRZoMye8fOsiTWZqYtkxvXkKm8BMzjT7t/vIdq (paste it into the Verify tab to try):

PartExampleMeaning
Version$2b$Algorithm identifier ($2a$, $2b$ or $2y$)
Cost10$log2 of the number of rounds: 210 = 1,024
SaltN9qo8uLOickgx2ZMRZoMye22 characters = 128-bit random salt
Checksum8fOsiTWZqYtkxvXkKm8BMzjT7t/vIdq31 characters = 184-bit result

bcrypt uses its own Base64 alphabet, ./A-Za-z0-9, which differs from standard Base64. Because the salt and cost are stored in the hash, a login check only needs the stored hash and the password the user typed.

Cost factor and work

CostRoundsRelative workTypical use
4–716–1281/64 – 1/8 of cost 10Unit tests only
101,0241×Default in many libraries (Node bcrypt, Spring Security, PHP)
124,0964×A common choice for new web applications
1416,38416×High-value accounts where slower logins are acceptable

Benchmark on your own production hardware and pick the highest cost that keeps a login comfortably fast. When users log in, you can rehash their password with a higher cost and store the new hash.

Using bcrypt in code

  • PHP: password_hash($pw, PASSWORD_BCRYPT, ['cost' => 12]) and password_verify($pw, $hash).
  • Node.js: await bcrypt.hash(pw, 12) and await bcrypt.compare(pw, hash) (bcrypt or bcryptjs packages).
  • Python: bcrypt.hashpw(pw.encode(), bcrypt.gensalt(12)) and bcrypt.checkpw(pw.encode(), hash).
  • htpasswd: htpasswd -nbB -C 10 user password writes a $2y$ bcrypt entry for Apache basic auth.

Frequently asked questions

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

bcrypt adds a random 128-bit salt to every hash and stores it inside the result (the 22 characters after the cost). Two users with the same password therefore get different hashes, and precomputed rainbow tables are useless. To check a password you hash it again with the salt taken from the stored hash, which is what the Verify tab does.

Which cost factor should I use?

Choose the highest cost your server can afford while keeping a login under roughly 100 to 300 milliseconds. Cost 10 is the default in many libraries; 12 is a common choice on modern hardware. Each step up doubles the time for you and for an attacker. The estimates in the tool are measured in this browser, and servers are usually faster.

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

They are the same algorithm with different version labels. $2b$ was introduced by OpenBSD in 2014 to fix a length bug in its own code, and $2y$ marks hashes from PHP's fixed crypt_blowfish. For passwords up to 72 bytes all three produce the same checksum, so most libraries accept any of them.

Why is bcrypt limited to 72 bytes?

bcrypt feeds the password into the Blowfish key schedule, which uses at most 72 bytes (including a terminating zero byte). Anything after that is ignored, so two long passwords that share their first 72 bytes produce the same hash. Note that characters outside basic Latin take 2 to 4 bytes in UTF-8.

Is it safe to enter a real password here?

The hashing happens entirely in your browser with JavaScript; nothing is uploaded or stored. Still, for production secrets it is good practice to generate hashes on the server or machine where they are used.

Can a bcrypt hash be decrypted?

No. bcrypt is a one-way function. The only way to recover a password is to guess candidates and hash each one with the stored salt and cost, which bcrypt deliberately makes slow.

Should I use bcrypt or Argon2?

Both are good choices. OWASP currently recommends Argon2id first, then scrypt, with bcrypt (cost 10 or more) as a sound option for existing systems. bcrypt is supported almost everywhere, including PHP, Node.js, Python, Ruby, Java and Go.

Are all the tools on FreeToolCabin tested for quality and accuracy?

Yes! Every tool on our site undergoes automated Q/A testing in real browser environments to ensure high precision, correct output, and zero errors. If you happen to spot a bug or have a suggestion, please contact us at [email protected] and our team will review it right away.

Related tools

Password GeneratorCreate strong passwords and passphrases.Hash GeneratorGenerate MD5, SHA-1, SHA-256 and SHA-512 hashes of text or files.UUID GeneratorGenerate UUID v4 and v7 / GUIDs in bulk and copy or download them.Base64 Encoder DecoderEncode or decode Base64 text and files, and make data URIs.HMAC GeneratorGenerate and verify HMAC signatures with SHA-256, SHA-512, SHA-1 or MD5.MD5 Hash GeneratorGenerate MD5 hashes of text, lines or files and verify checksums.Password Strength CheckerSee how strong a password really is, how long it takes to crack and how to improve it.PBKDF2 Hash GeneratorDerive PBKDF2 keys from a password, salt and iteration count with SHA-1, SHA-256 or SHA-512.URL Encoder DecoderPercent-encode or decode URLs, query strings and form data.HTML Entity Encoder / DecoderEscape and unescape HTML entities, named or numeric.Binary TranslatorConvert text to binary, hex, octal and back.CRC32 Checksum CalculatorCalculate CRC-32, CRC-32C, CRC-16 and Adler-32 checksums of text or large files.JWT DecoderDecode JSON Web Tokens, read the claims and expiry, and verify HS256 signatures.JWT GeneratorCreate and sign HS256, HS384 or HS512 JSON Web Tokens in your browser and verify them.Caesar CipherEncode and decode Caesar shift ciphers and crack unknown shifts with a ranked brute force.Vigenère CipherEncrypt and decrypt Vigenère and Autokey ciphers, and crack unknown keys with frequency analysis.Atbash CipherEncode and decode Atbash ciphers (A↔Z, B↔Y) in Latin or Hebrew, with a live letter mapping table.ASCII TableFull ASCII code chart 0–255 in decimal, hex, octal, binary and HTML, with search and copy.Unicode Character LookupFind Unicode characters by name or code point and copy them with UTF-8, HTML and code escapes.Punycode ConverterConvert international domain names, emails and URLs between Unicode and xn-- Punycode, in bulk.JSON Escape / UnescapeEscape text for a JSON string, unescape \n and \" back to text, or stringify a whole object.Binary to HexConvert binary to hex instantly with steps and signed mode.Hex to BinaryConvert hex to binary instantly with steps and signed mode.Binary CalculatorAdd, subtract, multiply, divide, AND, OR, XOR and shift binary numbers with decimal values.Hex CalculatorHexadecimal + − × ÷ and AND, OR, XOR, NOT, shifts with decimal and binary equivalents.Base32 Encoder / DecoderEncode and decode Base32 (RFC 4648), Base32hex, Crockford and z-base-32 from text, hex or files.Base58 Encoder / DecoderEncode and decode Base58 and Base58Check (Bitcoin alphabet) from text or hex, with checksum verification.Unicode Escape / UnescapeConvert text to \uXXXX, \u{...}, \x, &#...; or CSS escapes and decode them back.File Hash CheckerGet MD5, SHA-1, SHA-256 and SHA-512 checksums of files and verify them against a hash.TOTP GeneratorGenerate 2FA one-time codes from a secret key, create otpauth QR codes and verify codes.SSL Certificate DecoderDecode PEM SSL/X.509 certificates: subject, issuer, expiry, SANs, key and fingerprints.Text Encryption ToolEncrypt and decrypt text with a password using AES-256-GCM, entirely in your browser.Argon2 Hash GeneratorHash passwords with Argon2id, Argon2i or Argon2d and verify them against an encoded hash.Base64 to PDFDecode a Base64 string to a PDF with preview and download, or encode a PDF to Base64.Bitwise CalculatorCalculate AND, OR, XOR, NOT and bit shifts at 8–64 bits with a bit grid and all bases.CSR GeneratorCreate a certificate signing request (CSR) and private key with SANs, RSA or ECDSA, in your browser.MongoDB ObjectId to TimestampDecode a MongoDB ObjectId to its creation date, or build ObjectIds from dates for range queries.PGP Encrypt / DecryptEncrypt, decrypt, sign and verify PGP messages with your armored keys, entirely offline.CSR DecoderDecode a PEM certificate signing request: subject, SANs, key size, signature and CA readiness checks.Enigma Machine SimulatorEncrypt and decrypt with a virtual Enigma I, M3 or M4: rotors, rings, plugboard and lampboard.Hex Opacity CalculatorConvert opacity percent to a 2-digit HEX alpha code and full #RRGGBBAA color, with a 0-100% table.Playfair CipherEncrypt and decrypt Playfair ciphers from a keyword, with the 5x5 key square and every digraph step.Pwned Password CheckerCheck if a password appeared in data breaches; only 5 characters of its SHA-1 hash are sent.RSA Encryption ToolEncrypt text with an RSA public key and decrypt it with the private key using RSA-OAEP in your browser.SAML DecoderDecode SAMLRequest and SAMLResponse messages to readable XML, attributes and validity times.SSL Certificate ConverterConvert SSL certificates and keys between PEM, DER, PFX/P12 and P7B in your browser.Checksum CalculatorCompute 8-bit sum, two's complement LRC, XOR/BCC, NMEA, Fletcher and Internet checksums of bytes.Protobuf DecoderDecode raw Protocol Buffers hex or Base64 without a schema, or add a .proto for field names.XML Escape / UnescapeEscape & < > " ' for XML text and attributes, unescape entities back, or wrap text in CDATA.Binary Search Tree VisualizerInsert, delete and find in BST, AVL and red-black trees with animated rotations and traversals.PGP Key GeneratorGenerate an OpenPGP key pair (Curve25519, NIST ECC or RSA) with passphrase and expiry, offline.Quoted-Printable Encoder / DecoderEncode or decode quoted-printable email text (MIME) with UTF-8 and 76-character soft line breaks.Self-Signed Certificate GeneratorCreate a self-signed SSL certificate and key for localhost or dev servers, as PEM or PFX.SHA-1 Hash GeneratorSHA-1 and HMAC-SHA1 of text or files in hex or Base64, plus Git blob hashes and verify.SRI Hash GeneratorCreate Subresource Integrity hashes (sha256/384/512) and ready <script> or <link> tags.SSH Key GeneratorGenerate Ed25519 or RSA SSH key pairs in your browser: OpenSSH public key plus private key.String Escape / UnescapeEscape or unescape strings for JavaScript, Java, C#, Python, C, SQL, regex, CSV and shell.UTF-8 Encoder / DecoderConvert text to UTF-8 bytes in hex, decimal, binary, \x or % and decode bytes back to text.UUID Decoder & ValidatorDecode any UUID: version, variant, v1/v6/v7 timestamp and MAC node, plus bulk validation.Base64 to FileDecode Base64 or a data URI to a downloadable file; detects the real file type and previews it.File Encryption ToolEncrypt and decrypt any file with a password using AES-256-GCM, entirely in your browser.Passphrase GeneratorMake strong, memorable diceware passphrases from a 7,776-word list, with entropy in bits.
See all 65 Encoders, Hashes & Crypto →