DevKits

htpasswd Generator — Create Apache & Nginx Basic Auth Entries Online

Generate .htpasswd entries for Apache and Nginx HTTP Basic Authentication. Enter a username and password to get a bcrypt-hashed user:hash line, ready to paste into your htpasswd file. 100% local — the password never leaves your browser.

Last updated:

Comments

Enter a username and password to generate a bcrypt-hashed `user:hash` line for your .htpasswd file — ready for Apache or Nginx Basic Auth. The password never leaves your browser.

What is htpasswd Generator?

HTTP Basic Authentication protects a directory or endpoint with a username and password, checked against an .htpasswd file. Each line is `username:hash`, and this generator produces the hash with bcrypt — the same algorithm as Apache's `htpasswd -B` and the recommended format for Nginx. Bcrypt is salted and deliberately slow, so even if the file leaks, brute-forcing the passwords stays expensive; avoid the legacy MD5-crypt (apr1) and plain SHA formats for anything new. Everything is computed locally in your browser, so you can safely generate real production credentials here. Paste the resulting line into your .htpasswd file (one user per line), point your server's AuthUserFile / auth_basic_user_file at it, and reload.

How to generate an htpasswd entry

  1. 1Enter the username and password.
  2. 2Click Generate to compute the bcrypt hash in your browser.
  3. 3Copy the `user:$2b$...` line into your .htpasswd file (one per line).
  4. 4Configure Apache (AuthType Basic + AuthUserFile) or Nginx (auth_basic + auth_basic_user_file) and reload.

Key Concepts

bcrypt ($2b$)
A salted, adaptive password hash. The cost factor controls how slow it is — higher is safer but takes longer to verify.
.htpasswd file
A plain-text file of user:hash lines that Apache/Nginx read to authenticate Basic Auth requests.

Tips & Best Practices

  • ▸One user per line — append new entries rather than overwriting the file.
  • ▸Always serve Basic Auth over HTTPS; the credentials are only Base64-encoded in transit otherwise.
  • ▸A higher bcrypt cost resists brute-force better but adds latency to every login — 10–12 is a common balance.

Frequently Asked Questions

What hashing does this use?

Bcrypt — the same algorithm as Apache's `htpasswd -B` and the recommended choice for Nginx. Bcrypt is deliberately slow and salted, which makes brute-forcing stolen hashes expensive. Avoid the legacy MD5-crypt (apr1) and plain SHA formats for new deployments.

Is the password sent to a server?

No. The bcrypt hash is computed entirely in your browser in WebAssembly/JavaScript. The username and password never leave your device, so it's safe to generate credentials for production here.

How do I use the generated line?

Append the `user:$2b$...` line to your .htpasswd file (one user per line). In Apache, point AuthUserFile at it with AuthType Basic; in Nginx, reference it with `auth_basic` and `auth_basic_user_file`. Reload the server to apply.

Try Next

AES Encrypt / Decrypt

Encrypt and decrypt text with AES (128 / 192 / 256, GCM authenticated or CBC legacy) using a password. PBKDF2 key derivation with 200,000 iterations. 100% local — the Web Crypto API runs entirely in your browser.

Related Tools

Reference & Guides