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:
CommentsEnter 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
- 1Enter the username and password.
- 2Click Generate to compute the bcrypt hash in your browser.
- 3Copy the `user:$2b$...` line into your .htpasswd file (one per line).
- 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
HMAC Generator
Compute HMAC signatures with SHA-1, SHA-256, SHA-384, or SHA-512 online. Verify API requests, sign webhooks, and authenticate messages. Free, no signup — signing runs locally via the Web Crypto API, secrets never leave your browser.
JWT Decoder
Decode JSON Web Tokens (JWT) to inspect the header, payload, and signature. Runs entirely in your browser — tokens are never sent to any server.
Hash Generator
Generate MD5, SHA-1, SHA-256, and SHA-512 hashes of any text online. Free, no signup — all hashing runs entirely in your browser via the Web Crypto API, so nothing is uploaded.
ECDSA Key Generator
Generate elliptic-curve key pairs (P-256, P-384, P-521) for ECDSA signatures or ECDH key agreement. Exports PKCS#8 / SPKI PEM, JWK, and DER (hex/base64). Perfect for ES256/ES384/ES512 JWTs. 100% local via the Web Crypto API — the private key never leaves your browser.
MD5 Generator
Compute MD5 hashes of text or files instantly online. Drag-and-drop file support for checksums of any size (streaming, GB-scale friendly). Verify against a known MD5 with one click. 100% local — nothing is uploaded.
SHA-1 Generator
Generate SHA-1 (160-bit) hashes of any text or file online. Drag-and-drop file support for GB-scale checksums via Web Crypto API. Verify against a known SHA-1 in one click. 100% local.