PHP Password Hash Gen
Securely generate password hashes compatible with PHP's password_hash()
See the shape of a PHP password hash
PHP developers meet strings like $2y$10$... constantly, in user tables, seed files and tutorials. This page helps you understand that format and produces a matching password_verify() code example you can adapt. Please read the note below about what the generated value is, because it matters for how you use it.
Using the page
- Type a password into the Plaintext Password field. Load Sample inserts an example password and Clear empties it.
- Choose an option from the Algorithm menu: BCRYPT (Recommended), ARGON2I or DEFAULT.
- Move the Cost Factor slider between 4 and 15. The number beside it updates as you drag.
- Click Generate Hash.
- The Generated Hash Output panel shows the string, with a Copy Hash button. Under it, a PHP Implementation block gives a password_verify() example with your password and the generated string filled in.
Important: this is a format preview
The string is created by a small demonstration routine in your browser. It begins with a bcrypt-style $2y$10$ prefix followed by random characters, and it changes every time you click. It is not produced by PHP's password_hash() function, and the algorithm menu and cost slider do not change the value. That means the output will not pass password_verify() against your real password, and it should never be stored in a database or used to protect an account.
What it is good for
- Showing a student or colleague what a bcrypt-style hash looks like.
- Grabbing a password_verify() snippet to adapt in your own project.
- Creating placeholder values for UI mock-ups or documentation.
- Testing that a form field accepts a hash-shaped string.
How to create a real hash
In your own PHP environment, call password_hash($password, PASSWORD_BCRYPT, ['cost' => 12]) or simply password_hash($password, PASSWORD_DEFAULT), store the returned string, and check logins with password_verify(). Choose a cost your server can handle in a fraction of a second, and re-hash with password_needs_rehash() when you raise it. Argon2 support depends on how PHP was compiled.
Avoid entering real passwords into any online tool. Use throwaway sample values here.
Related Tools