The quick answer

A bcrypt hash is 60 characters: $2b$12$R9h/cIPz0gi305NNKcxP1e9mXYH3/Q/.P54GY.1v1ejm76mLUAdRi. The $2b$ marks the version, the 12 is the cost factor, the next 22 characters are a fresh random salt, and the final 31 are the digest. Cost 12 means 4,096 rounds of the Blowfish key schedule, and every run re-salts, so one password never produces the same hash twice.

What this page is, stated plainly

This page is the working reference for reading, calibrating and verifying bcrypt output. Its text box is the site's local hasher: it runs in your browser, never transmits what you type, and carries a standing note recommending bcrypt or argon2 for anything you actually store. That note is the right advice, and it points where production hashes come from: your stack's own library, with your cost factor, inside your code.

The sections below carry the anatomy, the library commands, the version history and the cost tables.

The anatomy of the 60 characters

Every bcrypt output has the same anatomy, 60 characters total: $2b$12$R9h/cIPz0gi305NNKcxP1e9mXYH3/Q/.P54GY.1v1ejm76mLUAdRi. The $2b$ is the version marker, the 12 is the cost factor, the next 22 characters are the Base64-encoded 128-bit salt, and the final 31 are the digest. The salt lives inside the hash, which is why nothing is stored alongside it and why hashing the same password twice yields different strings.

The engine is Blowfish's key schedule, bent to a purpose. bcrypt runs the expensive key setup 2^cost times, mixing the password and salt into every pass. Unlike SHA-256, which is fast because files are big, bcrypt is slow because passwords are weak: every unit of purchased slowness multiplies the cost of each GPU guess an attacker makes.

Verification re-runs the same schedule with the embedded salt and cost, then compares the final 31 characters. Two stored hashes of one password never match by design, so comparison is always verify-and-compare, never string equality.

Cost factorKey-setup roundsTypical use
416Interactive testing only
101,024A common floor for stored passwords
124,096A frequent production default
1416,384High-security logins with latency to spend

Calibrate the factor against real login latency, not a laptop benchmark: pick the cost that keeps a sign-in inside your latency budget on production hardware, revisit it as CPUs improve, and rehash old hashes opportunistically at sign-in. The OWASP cheat sheet linked below is the reference for scaling work factors with hardware.

Generating a hash in your own stack

Three commands cover most production situations. Each takes a password, applies its own random salt, and returns the same 60-character shape documented above.

One sanity check before trusting a new environment: generate a hash with your library, then verify it against the same library on the machine that will do the verifying. Prefix and cost travel inside the hash string, so a mismatch is almost always a truncating database column (60 characters, exactly) or a 72-byte password edge.

Reading the version prefixes

$2a$ is the original marker. $2y$ is PHP's crypt marker for output generated after crypt_blowfish fixed a 2011 sign-extension bug on high-bit bytes, and $2x$ is its marker for the buggy behavior. $2b$ is OpenBSD's 2014 fix for a wrap-around bug that made passwords longer than 255 characters wrap the length counter.

For plain ASCII passwords under 72 bytes, the three produce identical digests, and every modern library verifies all of them. Migration is therefore mostly a policy question: generate new hashes as $2b$, let old $2a$ hashes keep verifying, and rehash opportunistically as users sign in.

The 72-byte limit

Characters beyond byte 72 are silently ignored, and bytes are not characters: an é is two bytes in UTF-8, so a 40-character password with accents can already sit near the ceiling. Passphrases longer than 72 bytes get pre-hashed with SHA-256 before bcrypt in stacks that must keep them, or move to Argon2, which has no cap.

The limit also explains a classic fixture failure: two different long passwords hash to the same digest because they share their first 72 bytes. If a test asserts inequality, make the passwords differ inside the first 72.

Who reaches for this page

Three jobs bring readers here.

Backend developers seeding user tables: a real hash in a fixture beats a hand-typed $2y$something that fails authentication on the first login. The anatomy section above is what those fixtures must match, down to the 60-character length.

Security engineers calibrating cost: the round numbers above turn a latency budget into a setting, and the rehash-on-sign-in pattern retires old cost factors without a forced password reset.

Anyone migrating an auth system: generating the same password at the same cost in PHP, Python and Node and comparing the prefixes settles which library emits which version before a migration weekend, not during it.

Your password never touches a server here

The inputs people bring to password pages are, by definition, credentials, and the local rule on this site removes the entire network risk class for them: the text box computes in your browser, there is no request to intercept, and nothing persists after the tab closes.

The alternatives, compared honestly

AlternativeWhere it winsWhere this page wins
Your language's libraryThe right choice for production code; the commands above are exactly thatThe format, cost and version reference, ready in one page without a REPL or a deploy
Argon2 generatorsThe more modern algorithm: memory-hard, PHC winnerThe migration math and cost tables for the bcrypt hashes you already run
Online bcrypt sitesConvenience, when they actually generate the hashNo credential crosses a network boundary on this page, ever

Frequently asked questions

What is the format of a bcrypt hash?

Exactly 60 characters: $2b$12$R9h/cIPz0gi305NNKcxP1e9mXYH3/Q/.P54GY.1v1ejm76mLUAdRi. That is the version marker ($2b$), the cost factor (12), a 22-character Base64 salt, and a 31-character Base64 digest. The salt is embedded in the output, so nothing needs storing alongside it.

What cost factor should I use?

Start at 10 and benchmark upward on production hardware. Cost 10 is 1,024 key-setup rounds, cost 12 is 4,096, cost 14 is 16,384, and each increment of 1 doubles the work and the login latency. Re-benchmark as CPUs improve, and rehash old hashes on sign-in as the target climbs.

Can a bcrypt hash be reversed?

No. bcrypt is one-way: verification re-runs the expensive key schedule with the embedded salt and compares. There is no decryption, so attackers must guess passwords and pay the cost factor for every guess. That slowness is the design working, not a defect.

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

$2a$ is the original marker. $2y$ is PHP's crypt marker for output generated after crypt_blowfish fixed a 2011 sign-extension bug on high-bit bytes. $2b$ is OpenBSD's 2014 fix for a wrap-around bug that made passwords longer than 255 characters wrap the length counter. For plain ASCII passwords under 72 bytes the three produce identical digests.

Why does bcrypt truncate passwords at 72 bytes?

It inherits the limit from Blowfish's key schedule, which reads at most 72 bytes of key material: bytes beyond the 72nd are silently ignored. Bytes are not characters, so multi-byte UTF-8 passwords hit the ceiling sooner than they look. For longer passphrases, pre-hash with SHA-256 before bcrypt, or switch to Argon2, which has no length cap.

Is bcrypt still the right choice in 2026?

The construction has held for 27 years with no published break. Argon2id, the Password Hashing Competition winner and the subject of RFC 9106, is the more modern choice because its memory cost pushes back against GPU farms. Plain SHA-256 is wrong either way: fast hashes are what bcrypt exists to avoid.

Does this page upload my password?

No. The text box on this page computes locally in your browser, and no request carries the input. Production hashes belong in your own stack's library, where the cost factor and the verification path sit in code you control.

Sources and further reading

Sources and further reading

We cite primary sources (standards bodies, government agencies, official documentation) wherever they exist so you can verify every number on this page yourself.