htpasswd Generator
Build an Apache or nginx .htpasswd line and an HTTP Basic Authorization header from a username and password, with bcrypt, APR1, or SHA-1 hashing, entirely in your browser.
htpasswd Generator — Type a username and password to get two things at once: a ready-to-paste .htpasswd line for Apache or nginx basic-auth, and the matching HTTP Basic Authorization header your client would send. The header is base64 of user:pass and updates instantly, while the hashed .htpasswd line is computed when you press Generate. Everything runs locally with the Web Crypto API and an in-browser WebAssembly hasher, so your password is never uploaded to any server.
What is htpasswd Generator?
The htpasswd Generator is a free in-browser tool for creating credentials used by HTTP Basic Authentication. System administrators and web developers use it to protect a directory or admin panel behind a username and password without installing the Apache htpasswd command-line utility. It produces a single user:hash line you append to a .htpasswd file, choosing bcrypt (the strongest, $2y$ format), APR1 (Apache's portable MD5, $apr1$ format), or SHA-1 (SHA format). It also derives the corresponding Authorization: Basic header so you can test the same credentials with curl or a REST client. The bcrypt cost factor is configurable in Settings for stronger or faster hashing.
How to use htpasswd Generator
- Enter the username that will log in.
- Type the password to protect the account; it stays in this field and is never sent anywhere.
- Copy the Basic Authorization header right away if you only need it for an API request or curl test.
- Open Settings to pick the hash algorithm (bcrypt, APR1, or SHA-1) and, for bcrypt, the cost factor.
- Press Generate to compute the hashed .htpasswd line, then copy it into your server's .htpasswd file.
Examples
bcrypt line for a single user
Input
user: admin, password: s3cret, algorithm: bcrypt (cost 10)
Output
admin:$2y$10$... (a 60-character bcrypt hash, random salt each time)
HTTP Basic header for an API test
Input
user: admin, password: s3cret
Output
Basic YWRtaW46czNjcmV0
APR1 (Apache MD5) line for legacy configs
Input
user: web, password: pass123, algorithm: APR1
Output
web:$apr1$<salt>$<22-char hash>
Frequently asked questions
- Is my password sent to a server?
- No. Both the Basic header and the .htpasswd hash are computed entirely in your browser using the Web Crypto API and an in-browser WebAssembly hasher. Nothing is uploaded or stored on any server, so the tool works offline and your password never leaves the page.
- Which hash should I choose?
- Use bcrypt for new setups; it is the most resistant to cracking and is supported by modern Apache and nginx. APR1 ($apr1$) is Apache's portable MD5, useful for legacy configs. SHA-1 ({SHA}) is the weakest and best avoided unless a system specifically requires it.
- Why does the Generate button take a moment?
- bcrypt and APR1 are intentionally slow to resist brute-force attacks, and bcrypt also loads a small WebAssembly module on first use. A higher cost factor makes bcrypt slower but stronger. SHA-1 and the Basic header are instant.
- Does it match the real htpasswd command?
- Yes. bcrypt lines use the $2y$ prefix Apache expects, APR1 uses the standard $apr1$ format with a random salt, and SHA-1 uses the {SHA} scheme, all compatible with htpasswd-generated files.
- Can I use this for nginx?
- Yes. nginx's auth_basic_user_file reads the same .htpasswd format, so a bcrypt or APR1 line works directly. nginx does not support {SHA}, so pick bcrypt or APR1 for it.
Related tools
AES Text Encryption (AES-GCM + PBKDF2)
Encrypt and decrypt text with AES-256-GCM using a passphrase-derived key (PBKDF2 SHA-256, random salt), entirely in your browser with no uploads.
Argon2 & scrypt Hash
Hash a password with Argon2id or scrypt and verify an Argon2 hash against a password, entirely in your browser.
Bcrypt Hash Generator & Verifier
Generate a bcrypt password hash from plain text at a chosen cost factor, or verify a password against an existing bcrypt hash, entirely in your browser.
BIP39 Mnemonic Generator
Generate a random BIP39 recovery phrase of 12 to 24 words in several languages, or convert an existing mnemonic back into its raw entropy, entirely in your browser.