Bcrypt, Argon2 and PBKDF2 hash generator
Type a password, pick the algorithm your system uses and copy the hash you need to store. You can also check whether a password matches a hash. Free and private.
It is processed in your browser. It is not saved or sent. Do not have the password yet? Generate a strong password first
The most widespread way to store passwords. It gives a 60-character string that starts with $2b$ and that almost any system can check.
1,024 rounds. Each extra point doubles the time it takes.
All three are the same algorithm; pick the one your system writes. $2b$: Node.js (bcrypt), Python and OpenBSD.
Your hash
Store it whole and as it is: the algorithm, the values and the salt are inside the string.
How to check it in your system
- Node.js
await bcrypt.compare(password, hash) - PHP
password_verify($password, $hash) - Python
bcrypt.checkpw(password.encode(), hash.encode()) - Spring
new BCryptPasswordEncoder().matches(password, hash)
Build the SQL statement (optional)
Say where the password is stored and copy the UPDATE with the hash already inside.
Type the names as they appear in your database: they are quoted for the database you choose.
SQL statement
Generate a hash first to put it in the statement.
Before you run it, check that you are connected to the right database and that the condition affects only one user.
If you use it inside a terminal command, wrap it in single quotes: otherwise the shell interprets the $ signs of the hash.
Your passwords and hashes do not leave your deviceEverything is calculated in your browser. We never send or store the password or the hash.
How it works
- Type the password and pick the algorithm your system uses: bcrypt for almost everything, Argon2id, PBKDF2 for Django or scrypt for Flask. Adjust the cost if you need to.
- Press “Generate hash”. Hashes are slow on purpose, but the page keeps responding while they are calculated.
- Copy the hash and store it in your database. If you like, also build the SQL UPDATE statement, ready to run.
Related tools
Password Generator
Create strong passwords, memorable passphrases and random tokens without leaving your browser.
Merge PDF
Combine several PDFs into one document and put them in any order.
Image to PDF
Turn your photos and images into a PDF document.
MOV to MP4
Convert MOV videos, like those from an iPhone, to MP4 right in your browser.
Frequently asked questions
What is bcrypt and what is it for?
bcrypt is an algorithm for storing passwords. What gets stored is not the password but its hash: a 60-character string that is calculated slowly on purpose and with a random salt, so trying millions of passwords is very expensive. When someone signs in, the system calculates the hash of what they typed with the same salt and cost, and compares it with the stored one.
Which bcrypt cost should I use?
OWASP recommends 10 as a minimum, and more if your server can take it. The cost is an exponent: each extra point doubles the time, and 10 means 1,024 rounds. PHP raised its default from 10 to 12 in version 8.4. Pick the highest value at which signing in still feels quick on your server and, if you are changing a user’s password in an existing system, use the same cost as that system so all the hashes behave the same.
What is the difference between $2a$, $2b$ and $2y$?
In practice, none: they are versions of the same algorithm. $2a$ is the original; later came $2y$ (PHP’s mark for its fixed implementation) and $2b$ (OpenBSD’s, since 2014, which fixed a bug with very long passwords). For passwords of up to 72 bytes a correct implementation gives the same result with all three, and current libraries accept all three. Pick the one your system writes: $2b$ in Node.js and Python, $2y$ in PHP and Laravel, $2a$ in Spring Security.
Which is better: bcrypt, Argon2 or PBKDF2?
Argon2id is OWASP’s first choice for new systems: besides being slow it uses a lot of memory, which makes it more expensive to attack with graphics cards. bcrypt is still a good choice and is supported by almost every language, although it only reads the first 72 bytes of the password. PBKDF2 is the simplest and the one some standards require, but it needs many iterations (OWASP states 600,000 with SHA-256). In practice, use the one your system already knows how to check: a hash your application does not understand is of no use to you.
Why does the hash change every time I generate it?
Because every hash carries a new random salt inside it. All of them are valid for the same password: the system reads the salt from the stored hash, calculates again and compares. The salt makes two users with the same password have different hashes and makes tables of precomputed hashes useless.
Can a hash be reversed to get the password back?
No. A password hash only works one way. All anyone can do is try passwords one by one and compare, which is why these algorithms are slow. If a password has been lost, the right thing to do is replace it with a new one. And if you want to know whether a specific password corresponds to a hash, use the “Verify hash” tab.
Is it safe to hash a real password here?
The hash is calculated in your browser, in a thread separate from the page, and the password is not sent to our servers or saved anywhere: not in cookies, not in browser storage, not in the page address. It disappears when you close or reload the page. The only thing we measure, anonymously, is which algorithm is used, never the password or the hash. Even so, do it on a device and a browser you trust, and if you are changing someone else’s password, the best approach is to set a temporary one that they have to change when they sign in.
What is bcrypt’s 72-byte limit?
bcrypt only reads the first 72 bytes of the password and ignores the rest, so two passwords that match in those 72 bytes give the same hash. It is not 72 characters but UTF-8 bytes: an “ñ” takes 2 and an emoji 4. The tool warns you when you go over and calculates the hash from the first 72 bytes, as the real libraries do. For long passwords, use Argon2id or PBKDF2, which have no such limit.
How do I change a user’s password in the database?
Generate the hash with the same algorithm and values your system uses (look at the hash of an existing user: its prefix and cost tell you). Then open “Build the SQL statement”, enter the table, the column and the condition, and copy the UPDATE. Before you run it, check that you are connected to the right database, that the condition affects a single user and, better still, do it inside a transaction. Some systems add steps of their own, such as a pepper or a pre-hash of the password, and then this hash will not work. If you run the SQL from a terminal, wrap it in single quotes so the shell does not interpret the $ signs of the hash.
How do I generate a hash for Django or Flask?
For Django choose “PBKDF2-SHA256 (Django)”: the result has the pbkdf2_sha256$iterations$salt$hash format that Django stores in the password column. Django accepts hashes with fewer iterations than its current value and upgrades them the next time that user signs in. For Flask choose “scrypt (Werkzeug / Flask)”, which is the default format of generate_password_hash.
Can I check whether a password matches a hash?
Yes, in the “Verify hash” tab: paste the hash and type the password. The tool recognizes the algorithm from the start of the hash (bcrypt, Argon2, Django PBKDF2 or Werkzeug scrypt) and tells you whether it matches. Hashes in other formats, such as unsalted MD5 or SHA-1, are not supported.