Every service you use stores your password somehow, and the honest ones do not store the password itself. They store a hash: a scrambled fingerprint that can be checked when you log in but cannot be read back. When a database of password hashes leaks, the quality of that scrambling decides whether the leak is an embarrassment or a disaster.

bcrypt is one of the algorithms built for exactly this job, designed to be slow and salted. This guide explains what that means, why the same password produces a different hash every time, and how to generate and verify a real bcrypt hash with the free Bcrypt Hash Generator on Ovatly.

Contents

  • Quick answer
  • What bcrypt is, in plain terms
  • Why slow is the whole point
  • The salt: why the same password never hashes the same way twice
  • The cost factor
  • How to generate and verify a bcrypt hash, step by step
  • Worked example: one real hash of a famous passphrase
  • Limitations and honest tradeoffs
  • Common mistakes
  • FAQs
  • Conclusion
  • References

Quick answer

bcrypt is a password-storage algorithm that hashes a password slowly, on purpose, with a random salt mixed in. Slow means each guess in an attack costs real time; salted means the same password never produces the same hash twice, so precomputed rainbow tables are useless. In the Bcrypt Hash Generator you enter a password, set a cost factor (10 is the classic default), and generate a hash you can store. The verify section then confirms a password against a stored hash with a match or no-match verdict.

What bcrypt is, in plain terms

A hash function turns input into a fixed-length string. For file checksums you want that to be fast, so big files can be fingerprinted quickly. Password storage wants the opposite. When you log in, the service hashes the password you typed and compares it with the stored hash. An attacker who steals the stored hashes has to do the same thing, once per guess, over and over.

bcrypt is designed to make each of those attempts expensive. It is a password-storage algorithm, not a general-purpose checksum, and its two defining properties are that it is slow and that it salts every hash. A bcrypt hash is safe to store, which is the whole point: the database holds something that can verify a password without revealing it.

Why slow is the whole point

A hash can only be reversed by guessing: try a password, hash it, compare. There is no shortcut, so the defence is to make each guess cost as much as possible. A fast hash lets an attacker test enormous numbers of passwords per second, and weak passwords fall quickly. bcrypt's cost factor stretches a single check to a noticeable fraction of a second, which a real user never notices at login but which turns a billion guesses into a very long time.

That is why the guidance for real applications is to tune the cost so that a single check takes roughly 250 milliseconds on the production server, commonly 10 to 13, and to re-tune it as hardware improves.

The salt: why the same password never hashes the same way twice

Generate a hash of the same password twice and you get two different strings. bcrypt mixes a fresh random salt into every hash, so no two results match even when the password does. The salt is stored inside the result itself, and verification extracts it automatically to repeat the same computation.

The salt defeats precomputed rainbow tables. An attacker cannot hash a dictionary of common passwords once and compare the results against every stolen database, because each hash was made with a different salt. Every account has to be attacked individually, at the full cost of the algorithm.

The cost factor

The cost factor is the dial that sets how slow the hashing is. In this tool the range is 4 to 12. Cost 10 is the classic default; cost 12 is four times slower. Production systems sometimes use more, but in a browser tab higher costs freeze the page for a long time, which is why the tool warns you before running at cost 11 or 12. The right cost is high enough to punish guessing, low enough that real users never feel it at login.

How to generate and verify a bcrypt hash, step by step

  1. Enter the password or text to hash.
  2. Set the cost factor: 10 is the classic default, and 12 is four times slower.
  3. Press Generate bcrypt hash and copy the result.
  4. Optionally, paste a password and a hash into the verify section to see a match or no-match verdict.

The verify section treats a malformed hash as a simple no-match rather than an error, matching how a login check behaves.

Worked example: one real hash of a famous passphrase

Hashing the passphrase correct horse battery staple at cost 10 in this tool produced, in one run:

$2b$10$jT61zASMuZO.BYMYrC8tVOrG4f70YI6WdfYJA2RvF4xQe9jYzcUa.

Run the same passphrase yourself and you will get a different string, because a fresh random salt is mixed in every time. Paste either hash into the verify section with the same passphrase and the verdict is still a match: the verifier reads the salt out of the stored hash and repeats the work. You can also see the cost you chose, 10, sitting in the string after the $2b$ prefix, so everything needed to verify travels inside the hash itself.

Limitations and honest tradeoffs

bcrypt truncates input at 72 bytes, a known property of the algorithm, so a longer passphrase is effectively cut there. The tool's cost range is also capped at 12, because production-level costs would freeze a browser tab for a long time.

bcrypt remains widely used and acceptable, though newer systems often choose Argon2id, which resists GPU attacks better with memory hardness. And the tool is built for developers testing a login system and for anyone who wants to see what a real password hash looks like. The password you type is still a secret while you type it, even though this page never transmits it.

Common mistakes

  • Using a fast hash for passwords. SHA-256 and its relatives are built for speed, which is exactly wrong here. Never use a fast hash like SHA-256 for passwords.
  • Expecting the same hash twice. A different result on every run is the salt doing its job, not an error. Verify the password against the hash instead of comparing strings.
  • Setting the cost as low as it goes. A cheap hash means a cheap guess. Pick a cost that makes a single check take roughly 250 milliseconds on your server.
  • Treating a malformed hash as a system error. The verify section reports a simple no-match for a malformed hash, matching how a login check behaves.
  • Typing a production password into a test page. The password is a secret while you type it; this page never transmits it, but testing with throwaway passwords is the safer habit.

FAQs

Why is the hash different every time for the same password? bcrypt mixes in a fresh random salt every time it hashes, so the same password produces a different string on every run. The salt is stored inside the result, verification extracts it automatically, and the salt defeats precomputed rainbow tables.

What cost factor should a real application use? One that makes a single check take roughly 250 milliseconds on the production server, commonly 10 to 13 today. Re-tune it as hardware improves. In this tool the range is 4 to 12, and it warns you at cost 11 and 12 because higher costs freeze a browser tab for a long time.

Can a bcrypt hash be reversed back to the password? Only by guessing: try a password, hash it, and compare. The cost factor exists to make each guess expensive, which is why weak passwords still fall and strong ones hold.

Why not just use SHA-256 for passwords? SHA-256 is a fast hash, and fast is the wrong property for password storage. bcrypt is designed to be slow and salted, so each guessing attempt costs real time. Never use a fast hash like SHA-256 for passwords.

What happens to a very long password in bcrypt? bcrypt truncates input at 72 bytes, a known property of the algorithm, so anything beyond that point does not change the hash. A hash is safe to store, but the password you type here is still a secret while you type it, and this page never transmits it.

Conclusion

bcrypt's design is a deliberate trade: it spends a fraction of a second on every login so that an attacker has to spend that same fraction on every guess, and its random salt means no two stored hashes can be attacked with one precomputed table. The Bcrypt Hash Generator lets you generate and verify real hashes in your browser, with the cost factor under your control. For the opposite kind of hash, fast and built for files rather than passwords, see our companion guide, How to Verify a File Has Not Changed Using Its Hash. For more guides in this series, see our Security and Privacy Utilities guides.

References

  • Provos and Mazières, "A Future-Adaptable Password Scheme", USENIX Annual Technical Conference, 1999, the paper that introduced bcrypt.
  • Wikipedia, bcrypt, on the algorithm, its cost factor and the 72-byte limit: https://en.wikipedia.org/wiki/Bcrypt