# Bcrypt Hash Generator

> Generate secure Bcrypt password hashes with our easy-to-use online tool. Protect user data with adjustable cost factors, automatic salting, and resistance to brute-force attacks. Try it now!

Use the tool: <https://manamil.dev/tools/bcrypt-hash-generator>

## Free online bcrypt hash generator, checker and analyzer

Turn any password into a secure bcrypt hash, check passwords against hashes, read what a hash contains and find the right cost — all in your browser.

Everything on this page runs locally. Your password is not uploaded, logged or saved, which makes the tool safe for testing logins, debugging authentication and seeding databases. Jump to how it works, choosing the cost or the FAQ.

- **Runs in:** Your browser
- **Versions:** $2a$ · $2b$ · $2y$
- **Cost factor:** 4 – 31
- **Price:** Free, no sign-up

## How to use the bcrypt generator

Four steps cover everything: make a hash, check a password, read a hash and choose the cost.

1. **Generate a hash** — Type or paste the text, pick the cost factor and the prefix, and press Generate Hash. The hash is ready to copy or download in a fraction of a second.
   - Show / hide the text, and see how many of bcrypt’s 72 bytes you use
   - “Generate a password” creates a strong random one
   - $2y$ for PHP and Laravel, $2b$ for Node, Python and Go
   - “One per line” hashes up to 100 passwords at once
   - **Copy** or **Download TXT** saves the hashes only — there is no share link on purpose, so passwords never end up in a URL
2. **Verify a password** — Enter a password and a stored hash to see if they belong together — the same check as password_verify() or bcrypt.compare() in your login code.
   - Works with $2a$, $2b$ and $2y$ hashes
   - “Verify this hash” fills both fields from the generator
   - Shows the cost and how long the check took
3. **Analyze a hash** — Paste any bcrypt hash to see what it is made of and whether something is wrong with it.
   - Version, cost, 22-character salt and 31-character checksum, in colour
   - Warns about cut-off hashes, low cost and invalid characters
   - Tells you how long one check takes on your device
4. **Pick the cost** — The tool measures your device and shows how long each cost factor takes, so you can choose a safe value that does not slow your logins down.
   - Aim for about 250 ms per login
   - Never below cost 10 (OWASP)
   - Servers are usually a step faster than browsers

## What is bcrypt, and why it is safe

A password-hashing function from 1999 by Niels Provos and David Mazières, based on the Blowfish cipher — the default in PHP, Laravel, Rails and Spring.

- **Slow on purpose** — MD5 or SHA-256 compute billions of hashes per second on a graphics card. Bcrypt is built to be slow, so guessing passwords becomes extremely expensive.
- **Salted every time** — Each hash contains a fresh 128-bit random salt. Two users with the same password get different hashes, and rainbow tables stop working.
- **A cost you can raise** — The cost factor sets 2^cost rounds of work. As computers get faster you raise it by one and every new hash is twice as hard to crack.
- **One-way only** — A bcrypt hash cannot be decrypted. The only way back is to guess and hash again — which is exactly what bcrypt makes slow.

## The parts of a bcrypt hash

Always 60 characters. Salt and cost live inside the hash, so you store just this one string per user.

- **Version** — Which variant wrote the hash.
- **Cost** — 2¹⁰ = 1,024 rounds of key setup.
- **Salt** — 22 characters, 128 random bits.
- **Checksum** — 31 characters, 184 bits of hash.

## $2a$, $2b$, $2y$ and $2x$ explained

- **PHP & Laravel** (`$2y$`) — Written by password_hash() and Laravel’s Hash::make(). PHP’s label since 5.3.7 — the same algorithm as $2b$.
- **Node, Python, Go** (`$2b$`) — The current OpenBSD version (2014), written by most libraries today. Fixes a rare bug with passwords over 255 bytes.
- **Java & older systems** (`$2a$`) — The long-standing common label. Every modern library still reads it.
- **Legacy only** (`$2x$`) — Marks hashes made by an old, buggy PHP implementation. Only for upgrading old data — never create new ones.

Almost every library reads all three modern labels, so a hash made by Laravel ($2y$) can be verified in Node.js or Python, and back.

## How to choose the bcrypt cost

Every step doubles the work. Pick the highest cost your server can do in about 250 ms per login — and never less than 10, as the [OWASP cheat sheet](https://cheatsheetseries.owasp.org/cheatsheets/Password_Storage_Cheat_Sheet.html) advises.

- **Cost 8 · Tests only**: 256 rounds — Too fast for real passwords
- **Cost 10 · Classic default**: 1,024 rounds — Spring Security, most Node.js apps
- **Cost 11 · Good**: 2,048 rounds — Twice the work of cost 10
- **Cost 12 · Recommended**: 4,096 rounds — Default in PHP 8.4 and Laravel 11+
- **Cost 13 · High security**: 8,192 rounds — Fast servers, few logins
- **Cost 14 · Very slow**: 16,384 rounds — Logins take a second or more

The **Cost on this device** panel in the tool measures your own computer and suggests a value. Raising the cost later is safe: old hashes keep working and can be upgraded at the next login.

## 5 rules for using bcrypt

The mistakes that break logins most often — and how to avoid them. Not sure your site is served securely? Run the [SSL Server Test](https://manamil.dev/tools/ssl-server-test).

- **Only the first 72 bytes count** — Bcrypt ignores everything after byte 72. Letters like é or ü take 2 bytes, Urdu and Chinese characters 2–3, emoji 4. The counter in the tool shows the byte length and warns you. For longer passphrases, pre-hash them (for example HMAC-SHA-256) or use Argon2id.
- **Never compare hashes directly** — The same password gives a different hash every time because of the random salt. Always check with a verify function — password_verify(), Hash::check() or bcrypt.compare() — never with ==.
- **Store all 60 characters** — A bcrypt hash is always 60 characters. Use VARCHAR(60) or longer (VARCHAR(255) leaves room to switch algorithms later). A shorter column silently cuts the hash and every login fails.
- **Hash on your server** — In a real app the password travels over HTTPS to your backend, which hashes it. Use this tool for testing, debugging and seeding — and check your HTTPS setup with the SSL Server Test.
- **Raise the cost over time** — When you increase the cost, old hashes keep working. Upgrade them at the next login with password_needs_rehash() in PHP or Hash::needsRehash() in Laravel.

## Bcrypt vs Argon2, scrypt and SHA-256

How the common choices rank for storing passwords today.

- **Argon2id**: Best — Memory-hard; OWASP’s first choice for new systems.
- **scrypt**: Great — Memory-hard; a strong second choice.
- **bcrypt**: Good — Supported everywhere and simple; keep the cost at 10+.
- **PBKDF2**: OK — For FIPS-140 rules; 600,000+ iterations with SHA-256.
- **SHA-256 / MD5**: Never — Far too fast for passwords — billions of guesses a second.

## Bcrypt in PHP, Laravel and Node.js

The tool’s **Code examples** tab has ready snippets with your cost for 10 languages: PHP, Laravel, Node.js, Python, Django, Java, Go, C#, Ruby and Rust.

- **PHP**
- **Laravel**
- **Node.js**

## Questions people ask

### Is this bcrypt generator safe to use with real passwords?

Yes. The hash is calculated in your browser with JavaScript; the text you type is never sent to our server and is not stored. You can check it yourself: open your browser’s network tab while you press Generate Hash — no request is made. For production passwords, though, the hash should be made by your own server code when the user signs up.

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

Because bcrypt adds a new random salt to every hash. That is a feature: two users with the same password get different hashes, and pre-computed rainbow tables are useless. To check a password, do not compare hashes — use the Verify tab (or password_verify / bcrypt.compare in code), which reads the salt from the stored hash.

### Can a bcrypt hash be decrypted?

No. Bcrypt is a one-way function, not encryption, so there is nothing to decrypt. The only way to find a password from a hash is to guess passwords and hash each guess — which bcrypt deliberately makes slow. Long, unique passwords are therefore practically impossible to recover.

### Which cost factor should I use?

Use the highest cost your server can afford at about 250 milliseconds per login, and never less than 10 (OWASP). Today that is usually 10 to 12; PHP 8.4 and Laravel 11+ use 12 by default. The “Cost on this device” panel measures your machine; servers are often a little faster than browsers.

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

They are labels for the same algorithm. $2y$ is what PHP and Laravel write, $2b$ is the current OpenBSD label used by Node, Python and Go, and $2a$ is the older common label (Java, older systems). Almost every library accepts all three, so a hash made with one can be verified by the others.

### Why is my long password accepted with a wrong ending?

Bcrypt only reads the first 72 bytes of a password. Characters after byte 72 are ignored, so two long passwords that start the same give the same result. The byte counter in the tool warns you; if you must support longer passphrases, pre-hash them (for example with HMAC-SHA-256) or use Argon2id.

### Is bcrypt still secure in 2026?

Yes, with a cost of 10 or more it is still considered safe and is supported everywhere. OWASP now lists Argon2id as the first choice for new systems and scrypt as the second, with bcrypt as a solid option when those are not available. Never use MD5, SHA-1 or plain SHA-256 for passwords.

### How long is a bcrypt hash, and how do I store it?

Always 60 characters, for example $2y$10$ followed by 53 characters. Store it in a VARCHAR(60) or longer column (VARCHAR(255) is common, so you can switch algorithms later). A shorter column cuts the hash and every login will fail.

## Keep building with these tools

- [SSL Server Test](https://manamil.dev/tools/ssl-server-test) — Check the HTTPS certificate your login runs on
- [JSON Beautifier](https://manamil.dev/tools/online-json-beautifier) — Format, validate and convert API responses
- [DNS Checker](https://manamil.dev/tools/dns-checker-tool) — See where a domain points, worldwide
- [WHOIS Lookup](https://manamil.dev/tools/whois-lookup) — Who owns a domain and when it expires

---

Source page: <https://manamil.dev/tools/bcrypt-hash-generator> · Published by Manamil (https://manamil.dev)
