bcrypt Hash Generator: 60-Character Structure Explained

PublishedToolBcrypt Hash Generator & Verifier

Contents
  1. A Close Look Inside the 60-Character bcrypt Hash
  2. Why Is the Hash Different Every Time?: Random Salts and How Verification Works
  3. Under the Hood: Eksblowfish Key Expansion and the Cost Formula
  4. The Big Four Password Hashing Algorithms, Compared
  5. 5 Common bcrypt Mistakes
  6. A Flawless 5-Step Workflow for Generating and Verifying bcrypt Hashes
  7. 7 Practical bcrypt Tips
  8. The final decision tree: which hashing setup should you use?
  9. Cheat sheet: key bcrypt and auth security terms
  10. Frequently asked questions

Open the user table in your database and you've probably seen a strange 60-character string sitting in the password column, something like $2b$10$N9qo8uLOickgx2ZMRZoMyeIjZAgcfl7p92ldGxad68LJZdL17lhWy.

One of the most common questions newer developers ask is: "I hashed the same password, '1234', but the hash comes out completely different every time. Is that a bug?"

It's not a bug. It's bcrypt's core security design: a fresh 128-bit random salt is injected on every hash, which shuts down rainbow table attacks before they start.

Here's a full breakdown of the internal structure of the 60-character bcrypt hash, the math behind why the cost factor 2cost slows things down, the 72-byte limit, and the correct way to verify with 'bcrypt.compare()'.

Quick summary ① Fixed 60-character format: exactly 60 characters in the form 'version (4 chars)cost (2 chars)$salt (22 chars)+hash (31 chars)'. ② Exponential cost: every +1 on the cost factor doubles the work (2cost), which makes brute-force attacks useless. ③ Salt built in: the 22-character salt lives inside the hash string itself, so 'bcrypt.compare()' verifies perfectly without a separate salt column in your database. ④ With this simulator you can change the cost factor and version and walk through bcrypt hash generation and verification live in your browser, safely.

A Close Look Inside the 60-Character bcrypt Hash

A bcrypt hash string isn't just a blob of random characters. It's a tightly specified format made of four parts:

$2b$algorithm version (4 chars) 10$cost factor (3 chars) N9qo8uLOickgx2ZMRZoMye128-bit random salt (22 chars) IjZAgcfl7p92ldGxad68LJZdL17lhWyfinal hash (31 chars)
  1. Version identifier ($2b$): the revision of the bcrypt algorithm (2a, 2b, 2y, and so on — 2b is the global standard today).
  2. Cost factor (10$): means the key expansion loop ran 210 = 1,024 times.
  3. Salt (22 chars): a unique salt, made by encoding a 16-byte (128-bit) random value in base64.
  4. Hash body (31 chars): the final 184-bit digest produced by running the salt and password through the Eksblowfish engine 1,024 times.

Why Is the Hash Different Every Time?: Random Salts and How Verification Works

Every time bcrypt creates a hash, it generates a fresh 22-character salt using a CSPRNG (cryptographically secure pseudorandom number generator).

So even with the same password, 'password123':

  • First run: $2b$10$e8w...hWy
  • Second run: $2b$10$9Kq...7zQ

You get a completely different string. To verify, you don't hash again with a new salt. You pull the first 22-character salt out of the hash stored in your database and recompute with it plus the password the user typed, then check whether the 31-character hash body matches (constant-time compare).

Bcrypt Hash Generator & Verifier

Free · Enter a password and get a 60-character bcrypt hash in one second, with real-time checks for each cost factor


Under the Hood: Eksblowfish Key Expansion and the Cost Formula

Here's the math behind why bcrypt, unlike fast hashes like MD5/SHA-256, neutralizes GPU cracking.

1. Iteration Count as a Function of the Cost Factor (R)

Iterations = 2R
  • R = 10: 210 = 1,024 rounds (about 0.08 seconds, recommended for web services)
  • R = 12: 212 = 4,096 rounds (about 0.32 seconds, recommended for high security)
  • R = 14: 214 = 16,384 rounds (about 1.30 seconds, admin-only)
  • R = 16: 216 = 65,536 rounds (about 5.20 seconds, risk of overloading the server)

2. How bcrypt Defends Against GPU Brute-Force Attacks

  • SHA-256 is so cheap to compute that a hacker with a few dozen RTX 4090 GPUs can try hundreds of billions of passwords per second.
  • bcrypt forces memory-hungry 4 KB S-box tables and thousands of loops, knocking GPU parallel efficiency down to 1/100,000 and making cracking economically impossible.

The Big Four Password Hashing Algorithms, Compared

Metricbcrypt (RFC and global standard)Argon2id (latest PHC winner)PBKDF2 (government/finance standard)SHA-256 (plain hash)
Design goalOne-way password hashingNext-gen memory-hard hashingLegacy standard for key derivationData integrity checks
GPU resistanceExcellent (Eksblowfish)Extreme (memory control)Moderate (CPU iteration)Weak (tens of billions of guesses per second)
Salt built inFully embedded in the hash stringFully embeddedMust be managed separatelyNo salt support (manual)
Input length limit72 bytesUnlimitedUnlimitedUnlimited
Ecosystem support#1 worldwide (Node, Spring, Django)Spreading fastBuilt into standard librariesBuilt into every language

5 Common bcrypt Mistakes

  1. Comparing strings with === when checking a login: not knowing the salt changes every time, so you use a simple comparison instead of 'bcrypt.compare()'.
  2. Setting the cost factor to 15 or higher: it bottlenecks server CPU and can cause a denial-of-service (DoS) outage.
  3. Ignoring the 72-byte password limit: characters past the 72nd are cut off, so a login passes even when the trailing characters differ — a real security hole.
  4. Storing passwords with plain SHA-256/MD5: no salt, so a leaked database falls to a rainbow table in one second.
  5. Blocking the Node.js event loop with sync functions: using bcrypt.hashSync() so other users' web requests stall while the hash computes.

A Flawless 5-Step Workflow for Generating and Verifying bcrypt Hashes

  1. Step 1 (enter the password): type the plaintext password you want to test into the input field.
  2. Step 2 (set the cost factor): choose Cost 10 or 12, the standard for web services.
  3. Step 3 (generate and watch the progress): click [Generate Hash] and the engine inside your browser runs 2cost iterations, then outputs a 60-character hash.
  4. Step 4 (check the 60-character structure): confirm the version ($2b$), the cost (10), the 22-character salt, and the 31-character hash body all look right.
  5. Step 5 (try verification): enter a matching password and a wrong password to see 'bcrypt.compare()' pass and fail side by side.

7 Practical bcrypt Tips

  1. A cost factor of 10–12 is the sweet spot: it keeps server response times in the 100–300ms range while completely shutting down brute-force attacks.
  2. Use Node.js async promises: call the async method await bcrypt.hash(password, 10) so it runs in the multithreaded worker pool and your main loop doesn't get blocked.
  3. Beat the 72-byte limit with pre-hashing: wrap it like this — bcrypt.hash(crypto.createHash('sha256').update(pw).digest('hex'), 10).
  4. Prevent timing attacks: 'bcrypt.compare()' does a constant-time comparison internally, which blocks attacks that guess the password from differences in response time.
  5. Make your DB column VARCHAR(60) or VARCHAR(255): bcrypt output is always exactly 60 characters, so give the column at least 60 characters of room.
  6. Raise the cost as server performance improves: as server hardware gets faster, bump the cost by 1 every 3–5 years to keep the same security strength.
  7. Bookmark Bcrypt Hash Generator & Verifier: use it to instantly check whether a bcrypt hash stored in your DB matches the correct password while you're developing.

The final decision tree: which hashing setup should you use?

  • Case A (typical web/mobile B2C service with high-volume sign-ups) ➔ bcrypt (cost 10, response speed above all)
  • Case B (fintech, e-commerce, enterprise admin accounts) ➔ bcrypt (cost 12) or Argon2id
  • Case C (mandatory compliance with government/financial regulations) ➔ PBKDF2 (HMAC-SHA256, 100,000 iterations or more)
  • Case D (systems that support very long passphrases) ➔ SHA-256 pre-hashing ➔ combined with bcrypt

Cheat sheet: key bcrypt and auth security terms

  • bcrypt: an adaptive one-way hash function based on the Blowfish cipher, published in 1999 by Niels Provos and David Mazières.
  • Salt: a 128-bit random value added to the input so the same password still produces a different hash.
  • Rainbow table: a huge reverse-lookup attack dictionary of hundreds of millions of passwords and their corresponding plain hashes, all precomputed.
  • Key stretching: repeating the hash operation thousands to tens of thousands of times to physically slow down how fast an attacker can guess passwords.

Frequently asked questions

Why do I get a different hash every time I hash the same password?

bcrypt generates a fresh 128-bit random salt and combines it with the password on every run, so getting a different 60-character hash each time is completely normal and exactly how it's supposed to work.

Can I decrypt a bcrypt hash back to the original plaintext password?

No. bcrypt is a one-way cryptographic hash, so a decryption function that reverses it to plaintext doesn't exist mathematically.

Does the test password I enter get logged or collected by the web server?

Not at all. All hashing in this simulator runs locally in the JavaScript engine inside your browser, so your password is never sent to an external server.

This article was adapted from our Korean original. Read the Korean original

Related articles

  1. Brand Name Combiner: Turn Two Words Into Name CandidatesSee how two words turn into 14 brand name candidates with join, hyphen, syllable mix, and suffix rules, plus what the tool does not check.
  2. Business English Email Phrases: Formality Levels ComparedCompare business English email greetings, requests, apologies, and sign-offs by formality, with sentences for Dear vs Hi and Best regards vs Sincerely.
  3. camelCase vs snake_case: How the Conversion Rules WorkSee exactly where a converter splits text into words and how each format joins them again, including what happens with acronyms, numbers, and mixed scripts.
  4. Character Count With or Without Spaces: How to Match the LimitCharacter counts differ by tool. Why cover letters and reports count spaces, line breaks, and bytes differently, and how to check any counter yourself.
  5. Remove null and empty values from JSON: what stays and what goesClean null, empty strings, arrays, and objects out of JSON with one recursive rule. See why 0 and false survive and when invalid JSON is rejected.
  6. A record vs CNAME: the difference and how to validate the formatA records point a host to an IPv4 address; CNAMEs point it to another domain name. See how each looks in a zone file and how to check your input.

Related tools