htpasswd Generator (bcrypt, APR1-MD5)
Create .htpasswd lines for Apache and nginx basic auth with bcrypt, APR1-MD5 or SHA-1, plus the .htaccess and nginx snippets. Verify an existing line too.
Apache and nginx can protect a folder or a whole site with HTTP basic authentication, reading user names and hashed passwords from an .htpasswd file. This generator writes those lines in your browser with bcrypt, Apache’s APR1-MD5 or the old {SHA} format, and gives you the matching .htaccess block and nginx location. Verify mode checks whether a password matches an existing line.
How to use this tool
- Enter one username:password per line.
- Choose bcrypt for Apache 2.4, or APR1 if nginx or older software must read the file.
- Copy the lines into your .htpasswd file, stored outside the web root.
- Add the .htaccess or nginx snippet with the file’s full path and reload the server.
Formula
bcrypt: $2y$cost$ + 22-character salt + 31-character hash. APR1: $apr1$ + salt + $ + 22 characters from 1,000 rounds of MD5 (md5crypt). {SHA}: "{SHA}" + Base64(SHA-1(password)).
Each bcrypt step in cost doubles the work. APR1 uses the same md5crypt algorithm as FreeBSD and Linux "$1$" passwords with a different prefix, which is why openssl passwd -apr1 produces identical lines. Apache also accepts DES crypt() on Unix, which only uses the first 8 characters of a password, and plain text on Windows; this page writes neither.
Example
For the user admin with password "correct horse" and the salt r31pXvGt, the APR1 line is admin:$apr1$r31pXvGt$pMQoWLGzP8UBgCp7jD8k7. — exactly what openssl passwd -apr1 -salt r31pXvGt prints. In {SHA} form, the password "password" becomes {SHA}W6ph5Mm5Pz8GgiULbPgzG37mj9g=.
Frequently asked questions
Which format should I choose?
bcrypt if the server is Apache 2.4 or later (htpasswd -B). APR1 if nginx, older Apache or other tools must read the file. Avoid {SHA}: it is unsalted and fast to crack.
Are the passwords sent anywhere?
No. Hashing runs in your browser; nothing leaves the page.
Why does the same password give a different line each time?
bcrypt and APR1 add a random salt to every hash, so two users with the same password still get different lines. The server reads the salt back from the line when it checks a login.
Sources
Last updated:
Page address with these inputs: https://kakao.mobile/tools/htpasswd-generator/
Cite or embed this tool
kakaoCalc. (2026, November 8). htpasswd Generator (bcrypt, APR1-MD5). https://kakao.mobile/tools/htpasswd-generator/
“htpasswd Generator (bcrypt, APR1-MD5).” kakaoCalc, 8 Nov. 2026, kakao.mobile/tools/htpasswd-generator/.
Paste this code into your page. The widget runs in your visitors' browsers, shows no ads and keeps a link back to this page. Embedding terms