01What is htpasswd Generator?
htpasswd Generator writes the username:hash lines that Apache's AuthUserFile and nginx's auth_basic_user_file read for HTTP Basic Authentication. It's handy when you need to lock down a staging site and don't have the htpasswd command on the machine in front of you. The tool produces the same three formats that Apache's own htpasswd program documents. bcrypt is the default. It gives a $2y$10$ hash with a random 16-byte salt and cost 10, which is what htpasswd -B writes. APR1-MD5 gives Apache's $apr1$ variant of md5crypt with a random 8-character salt, the format behind htpasswd -m. SHA-1 gives {SHA} followed by the Base64 of the password's SHA-1 digest, matching htpasswd -s. All three hash the password as UTF-8 bytes, so accented letters and other non-ASCII characters work. The hashing code is written in plain JavaScript inside the page, including the bcrypt and MD5 parts, and salts come from crypto.getRandomValues. Nothing is sent to a server. Here's a worked example you can check yourself. With SHA-1, the user admin and password password become admin:{SHA}W6ph5Mm5Pz8GgiULbPgzG37mj9g=. Run it again and you get the same line, because {SHA} has no salt. Switch to bcrypt or APR1-MD5 and every click gives a different line, and every one of them is valid. If you feed our APR1 code the fixed salt saltsalt, the password password hashes to $apr1$saltsalt$yAAkm4libquA.ZWLHbSBq/. In the page the salt is random, so that exact string only shows up when you fix the salt in code. You can add as many users as you like with Add User. Rows with an empty username or password are skipped. A username with a colon or a line break is refused, because the file format splits on the colon and reads one user per line. bcrypt takes a moment per user, so the button shows Hashing while it runs. A few honest limits. bcrypt only reads the first 72 bytes of a password, which is part of the algorithm, not a bug here. APR1-MD5 is a thousand rounds of MD5 and {SHA} is a single unsalted SHA-1, so both are cheap to brute-force if the file leaks. Use bcrypt for anything new. The tool doesn't read or verify an existing .htpasswd file, and it doesn't offer the old DES crypt format.
Developers and sysadmins who need a quick Basic Auth password file for a staging site, admin path or internal dashboard behind Apache or nginx. The tool runs entirely in your browser, so your data never leaves your device.
02How to use htpasswd Generator
- Pick the Hash Algorithm: bcrypt, unless an older server specifically needs APR1-MD5 or SHA-1.
- Type a username and password in the first row. Click Add User for each extra account.
- Click Generate .htpasswd and wait while the button reads Hashing.
- Copy the .htpasswd Output into your file, one user per line, replacing any older line for the same user.
- Point Apache's AuthUserFile or nginx's auth_basic_user_file at the file and reload the server.
03Worked examples
- Input:
admin / password (SHA-1) - Result:
admin:{SHA}W6ph5Mm5Pz8GgiULbPgzG37mj9g= - SHA-1 is unsalted, so the same password always gives the same line.
- Input:
alice / secret (SHA-1) - Result:
alice:{SHA}5en6G6MezRroT3XKqkdPOmY/BfQ= - Input:
deploy / changeme (SHA-1) - Result:
deploy:{SHA}+pvrmeQCmtWmYVOZ57uuITVghrM= - Base64 of the SHA-1 digest, computed with Node's crypto to match the standard algorithm the tool uses.
- Input:
bob / pässword (SHA-1) - Result:
bob:{SHA}I7dElEdfX4dJgLdnbVEeI9iG2mQ= - Non-ASCII characters are hashed as their UTF-8 bytes.
- Input:
password with APR1-MD5 and the fixed salt saltsalt - Result:
$apr1$saltsalt$yAAkm4libquA.ZWLHbSBq/ - Output of the tool's own apr1Hash function with a fixed salt. In the page the salt is random, so your line will differ.
04Common use cases
- Creating the password file for a staging site or admin path behind Apache or nginx Basic Auth
- Adding a few reviewer accounts for a client preview when you have no shell access to run htpasswd
- Replacing an old {SHA} or $apr1$ line with a bcrypt line for the same user
- Building a small test .htpasswd file to bake into a Docker image or a CI job
- Protecting a Prometheus, Grafana or docs endpoint with a reverse proxy that reads htpasswd files
- Checking what a {SHA} line should look like when you're debugging a login that keeps failing
05Tips
- Prefer bcrypt. APR1-MD5 and {SHA} exist for compatibility and fall quickly to offline guessing.
- Keep the .htpasswd file outside the web root, or make sure the server refuses to serve it.
- nginx hands $2y$ hashes to the system crypt() function. If bcrypt lines fail on an older Linux, test there before falling back to $apr1$.
- Passwords longer than 72 bytes are cut off by bcrypt, so extra characters past that point add no strength.
- Basic Auth sends the password with every request, so only use it over HTTPS.
06Related concepts
HTTP Basic Auth, bcrypt, APR1-MD5, Apache authentication, .htaccess.
Frequently Asked Questions
What is htpasswd Generator?
htpasswd Generator is a free, browser-based developer tool on AIDToolStack. Generate Apache htpasswd entries for HTTP basic authentication. It requires no installation or sign-up and works entirely in your browser.
Is htpasswd Generator free to use?
Yes. No sign-up, no fees and no usage cap.
Does htpasswd Generator store my data?
No. It runs in your browser; nothing is uploaded.