1001Ferramentas
🛡️ Dev

.htpasswd bcrypt Generator

Build the .htpasswd line with a real bcrypt hash ($2y$ prefix), the scheme Apache recommends. You pick the cost and everything is computed in your browser.

Real bcrypt, computed in your browser — nothing is sent to a server. The salt is drawn fresh on every click, so the same password produces a different hash each time. That is expected.

The .htpasswd line, with bcrypt computed in your browser

.htpasswd is the file holding the usernames and passwords for basic authentication in Apache and nginx. Each line carries the username, a colon and the password hash — the password itself never appears. Among the schemes Apache accepts, bcrypt is the recommended one: it was designed to be slow on purpose, which makes brute forcing expensive even with dedicated hardware.

Enter the username, the password and the cost, and the page returns the finished line. Cost is the work factor: each extra point doubles the computation time. Cost 10 takes a few tenths of a second, cost 14 already runs past a second — and that slowness is what protects the file if it ever leaks. The measured time appears under the result, which helps you choose: the rule of thumb is to raise the cost until the calculation takes somewhere between 200 and 500 milliseconds on the server where the login will run.

The whole calculation happens in your browser, so the password never travels anywhere. The 16-byte salt is drawn fresh on every click, which is why the same password produces a different line each time — and that is exactly right: the salt is what stops two accounts with the same password from sharing a hash. Any of the generated lines will authenticate normally.

Frequently asked questions

Which cost should I use?
Ten is the htpasswd default and remains reasonable. Twelve is a common pick in 2026 for sensitive data. The criterion is not the number: it is the time on the server where authentication runs. Measure it, and choose the highest cost that still keeps login imperceptible for the person signing in — remembering that this cost is paid on every authenticated request.
Why does the hash change every time I click?
Because of the random salt, which is part of the hash and is stored inside it — the 22 characters right after $2y$NN$. When checking a password, the server reads the salt out of the hash itself and redoes the calculation. Having different hashes for the same password is precisely what defeats precomputed table attacks.
Is the $2y$ prefix different from $2a$ or $2b$?
All three mark variants of the same algorithm. $2a$ is the original; $2y$ appeared in PHP to signal a fix for an 8-bit character handling bug; $2b$ is the OpenBSD version carrying the same fix. For ASCII passwords all three produce identical results, and Apache accepts every one. $2y$ is what htpasswd -B generates.

Related Tools