Online Bcrypt hash & verify

Bcrypt hashes a password into a 60-character string that starts with $2a$, embeds the cost, and embeds a new random salt every time. Hash mode picks cost 4 through 15, default 10, and writes a fresh $2a$ string. Verify mode takes the password and the full hash from a database and reports match, no match, or invalid format. $2b$ and $2y$ verify the same way. The same password hashed twice yields two different strings because the salt changes. Bcrypt is for password storage, not for checksums of files.

What bcrypt embeds when a password meets a new salt and a chosen cost

Bcrypt stretches a password with Blowfish and packs salt, cost, and digest into one printable line. The password is the UTF-8 bytes of the text that was typed. A prefix such as $2a$, $2b$, or $2y$ names the variant, then two digits from 04 through 15 name the work factor, then a dollar sign, then fifty-three characters from the bcrypt base64 alphabet. The full string is sixty characters in the usual layout.

Each hash draws a fresh random salt, so hashing the same password twice at cost 10 yields two different sixty-character lines. The segment $2a$10$ in $2a$10$N9qo8uLOickgx2ZMRZoMyeIjZAgcfl7p92ldGxad68LJZdL17lhWy names cost 10; the following fifty-three characters hold salt and hash together. Only a compare against the full line can confirm a password. This page defaults cost to 10.

Password storage also uses slow PBKDF2 and memory-hard Argon2. A single fast digest without salt belongs under hash digest, and legacy MD5 was never meant for logins. Human-chosen secrets are easier to reason about with a password generator before they are hashed.

How prefix, cost digits, salt, and the fifty-three tail fit one verify step

Why $2a$, $2b$, and $2y$ label bcrypt variants that share salt and cost rules

  1. $2a$ is the common prefix many libraries emit for new hashes. $2b$ is a corrected $2a$ branch common in Node stacks. $2y$ often appears in PHP password_hash output.
  2. All three use the same sixty-character shape, the same two-digit cost field, and the same fifty-three character tail alphabet using dot and slash.
  3. Verify treats them interchangeably when the library is current. The prefix does not name a different password algorithm, only which bugfix label the emitter chose.

Why cost digits from 04 through 15 sit inside the string and scale each guess

  1. The two digits after the first dollar block are the work factor. Cost 4 is the minimum here, cost 15 is the maximum, and cost 10 is the default.
  2. Each step up doubles the Blowfish setup work inside the hash. Cost 12 is noticeably slower than cost 10 on the same hardware.
  3. The cost is stored in the string, so verification reads the same digits the hash was created with. Changing the slider only affects newly generated lines.

Why a new salt on every hash makes identical passwords produce different lines

  1. The random salt lives inside the fifty-three character tail, not in a separate database column, though apps may still store the whole line in one field.
  2. Two hashes of the word password at cost 10 share the $2a$10$ header pattern but diverge in every tail character.
  3. That divergence blocks rainbow tables built for one salt. It does not hide the password; it only forces per-hash guessing work.

Why verification needs the entire stored line including every prefix byte

  1. Compare parses prefix, cost, salt, and digest from the hash argument. A truncated copy or a bare digest without the $2a$ header is invalid input.
  2. The regular form is dollar, 2, variant letter, dollar, two cost digits, dollar, then exactly fifty-three alphabet characters.
  3. Matching means the password bytes and the full hash string pair correctly. It does not recover the password from the line alone.

Where the database line and the typed password quietly disagree

The same short password hashed twice at cost 10

Run hash twice on the word password with cost 10. Both lines begin with $2a$10$ or $2b$10$ depending on the library, and both are sixty characters long. The tails differ because the salt is new each time. A test that expected the same string twice is misunderstanding bcrypt. Verification still accepts either line when the password field holds password and the hash field holds the matching full string.

A row that stored only the fifty-three tail without the $2a$10$ header

Verification expects the complete printable hash. Dropping the prefix and cost removes the salt framing the algorithm needs. Pasting N9qo8uLOickgx2ZMRZoMyeIjZAgcfl7p92ldGxad68LJZdL17lhWy without $2a$10$ in front fails format checks. Production tables store one column with the entire line copied from registration. Debugging login means comparing the whole field, not a substring.

A legacy table that still holds unsalted MD5 beside a modern bcrypt column

MD5 of a password is one fast step with no cost field and no embedded salt. Moving users forward means rehashing at login with bcrypt cost 10 or higher, or running a staged migration. MD5 pages explain the digest shape. hash digest covers other bare hashes. PBKDF2 and Argon2 are alternate slow stores when policy picks them instead of bcrypt.

Common questions

What does a bcrypt hash look like on this page?
Expect about sixty characters starting with $2a$, $2b$, or $2y$, then two cost digits, then another dollar sign, then fifty-three characters drawn from ./0-9A-Za-z. Example shape: $2a$10$N9qo8uLOickgx2ZMRZoMyeIjZAgcfl7p92ldGxad68LJZdL17lhWy names cost 10 in the $2a$10$ segment. Copy the entire line into a database or verify field. Spaces or line breaks break parsing.
What is the difference between $2a$, $2b$, and $2y$?
All three mark bcrypt strings with the same cost and tail layout. $2a$ is the label many generators use for new hashes. $2b$ reflects a fixed handling issue in some $2a$ emitters and is common in JavaScript bcrypt ports. $2y$ is the prefix PHP often prints. Verification libraries usually accept every variant when the rest of the string is well formed.
Which cost value should I pick between 4 and 15?
Cost 10 is the default here and matches many web apps. Cost 4 is fastest and fits quick experiments. Cost 12 through 15 multiply work sharply and belong on hardware that can spare the time. The chosen cost is encoded in the hash, so raising cost later only affects newly created lines unless users rehash at login.
Why do two hashes of the same password never match?
Bcrypt generates a new random salt for every hash call. The salt is inside the fifty-three character tail, so equal passwords still produce unrelated strings. That is expected behavior, not a bug. Verification compares the candidate password against one specific stored line. It does not expect two registrations to share the same hash bytes.
How do I verify a password against a database hash?
Choose verify mode, type the plaintext password, and paste the full hash from the database including the $2a$, $2b$, or $2y$ prefix and both cost digits. The tool reports match or no match. Partial strings fail as invalid. The password must be the same bytes the user typed at registration, including case and any trailing newline if the app kept it.
How is bcrypt different from MD5 or a single SHA-256?
MD5 and one-step SHA-256 are fast and unsalted in naive designs, so identical passwords yield identical digests. Bcrypt is deliberately slow and always salted inside the stored line. Legacy MD5 and the hash digest page describe quick digests. PBKDF2 and Argon2 are other slow choices when standards committees prefer them.
Can bcrypt output be reversed into the password?
No. The line is a one-way encoding tuned for password checking. Attackers guess passwords and run compare, they do not decode the tail back to text. A stronger cost only makes each guess slower. Good passwords still matter; bcrypt does not remove the need for entropy. A password generator helps when humans pick secrets.
Does changing cost on the slider rewrite an old hash?
No. The cost digits inside an existing string are part of what verify reads. Moving the slider to 12 before hashing creates new lines with $2a$12$ or similar, but an old $2a$10$ row still verifies with cost 10 baked in. Rehashing at login is how apps upgrade users when policy raises the work factor.