htpasswd Generator
Make htpasswd lines in bcrypt $2y$, SHA-512 crypt or APR1, see which format your Apache or Nginx reads, and check a password against an existing htpasswd file.
- Runs in your browser
- Tool input is not uploaded to ZeroTool servers
- Free · No Sign-Up
Scan with WeChat to share this tool
Examples, details and FAQ Worked examples, how it compares with other tools, and answers to common questions.
Which Format Your Server Reads
Apache's Password Formats page lists bcrypt ($2y$), APR1 MD5 ($apr1$), SHA-1 ({SHA}), CRYPT and plain text. The htpasswd manual adds SHA-256 and SHA-512 crypt (-2, -5). Nginx's auth_basic_user_file handles $apr1$, {SHA}, {SSHA} and {PLAIN} itself and hands everything else to the system crypt(). Apache does the same for anything except $2a$, $2y$, $apr1$ and {SHA} (apr_password_validate in APR's apr_passwd.c).
So bcrypt in Nginx depends on the operating system. We loaded lines from this tool into real servers on 2026-10-01 and called curl -u against them:
| Format | Apache 2.4.68 (Debian 13) | Apache 2.4.67 (macOS htpasswd -v) | Nginx 1.29.8 (Debian 13, Alpine 3.23) |
|---|---|---|---|
bcrypt $2y$ / $2a$ | yes | yes | yes |
| SHA-512 / SHA-256 crypt | yes | no | yes |
APR1 $apr1$ | yes | yes | yes |
SHA-1 {SHA} | yes | yes | yes |
| CRYPT (DES) | yes | yes | yes |
| Plain text | no | no | no |
{PLAIN} | no | no | yes |
The system crypt() decides the Nginx column on other systems: on CentOS 7.9 (glibc 2.17) and Ubuntu 18.04 it rejected all bcrypt hashes but accepted SHA-512 and SHA-256 crypt; Ubuntu 20.04, 22.04, 24.04, Debian 11 and AlmaLinux 9 accepted bcrypt. If a bcrypt line keeps failing on such a system while the password is right, switch to SHA-512 crypt.
Examples You Can Reproduce
User deploy, password Correct-Horse-42, generated once in each recommended format (salts are random, so your lines will differ):
deploy:$2y$10$B5ZE66PBlA9fW9mqo.EoquP8tf/AH7r2EEtgXBIZ2ceg5y2fU/0ry
deploy:$6$HLH5kRcZe8Fqc0Le$QJkO5CYVlFo.pYo23jSa8Tx2e.OPY5bI1AuvYBQCI0auFmXvW4DMvQ86EggszD.BaG/6123jvdJ6vfSiujpkk.
deploy:$apr1$WCk.8Wc2$rEoqVyFbdWIWrm6GZy8dK.
Each line passes Apache's own check (htpasswd -vb file deploy Correct-Horse-42 prints Password for user deploy correct.); the SHA-512 line was checked with htpasswd inside the httpd:2.4 container, because macOS htpasswd has no SHA-2 crypt.
The Apache documentation example. Open Check or edit an htpasswd file, paste myName:$2y$05$c4WoMPo3SXsafkva.HHa6uXQZWr7oboPiC2bT/r7q1BB8I2s0BRqC, enter myName and myPassword in the input fields and press Check password: the result is Line 1: the password matches myName (bcrypt $2y$, cost 5). The same works for the $apr1$, {SHA} and CRYPT examples on that page.
A Docker registry. The registry's htpasswd authentication reads only bcrypt; per its configuration reference, entries with other hash types are ignored. Choose bcrypt $2y$ (Go's bcrypt package, which the registry uses, accepted the $2y$ and $2a$ lines from this tool in our test).
Checking and Editing an Existing File
Paste a file and every user line gets its format and a note. For this file:
# staging
deploy:$2y$10$B5ZE66PBlA9fW9mqo.EoquP8tf/AH7r2EEtgXBIZ2ceg5y2fU/0ry
ops:{SHA}QTP3Zyeatz4Ck0oFIxA2hCGcmlg=
deploy:$apr1$WCk.8Wc2$rEoqVyFbdWIWrm6GZy8dK.
qa:secret
- Line 3 starts with a space: Apache strips it and reads the user
ops, Nginx readsops. It is also unsalted SHA-1. - Line 4 repeats
deploy. Apache (mod_authn_file) and Nginx stop at the first match, so line 2 is the one that counts. - Line 5 is plain text, which Linux Apache and Nginx both reject.
Add or update user follows htpasswd -b: every line of that user is replaced where it stands, comments and blank lines stay, a new user goes to the end, and the file keeps its line endings. Remove user deletes every line of the user, like htpasswd -D. The textarea then holds the new file; copy or download it.
Usernames and Passwords the Servers Read Differently
- Colon. The colon separates name and hash, and htpasswd exits with code 6 for a name that contains one. Several online generators simply write
a:b:$apr1$…, which Apache reads as usera. #at the start. Apache and Nginx treat the line as a comment; the user can never log in.- Non-ASCII text. Servers compare bytes. This tool hashes UTF-8, so a client has to send UTF-8 as well;
curl -ufrom a UTF-8 terminal did, and both servers accepted a Japanese password. - Length. bcrypt reads 72 bytes of the password, so a 25-character Chinese or Japanese password (75 bytes) is cut; the tool warns before hashing. CRYPT reads 8 bytes. This tool stops at 255 bytes; Apache's own 255-character limit applies on Windows, where longer passwords are truncated.
How It Differs from Other Online htpasswd Generators
Tested on 2026-10-01 in desktop Chromium, recording the page's network requests:
- web2generators.com (first on Bing for "htpasswd generator") sends the username and password to its server in a POST request and returns an APR1 line. For the username
a:bit returnsa:b:$apr1$…. - htpasswd.utils.com hashes in the browser and its bcrypt, APR1 and SHA-1 output verified with htpasswd. It also writes
a:b:…fora:b, and offers{SHA256}and{SHA512}options that neither Apache 2.4 nor Nginx 1.29 accepted when we tried them.
None of the generators we tested checks a password against an existing line. This one does, flags the lines Apache and Nginx read differently, and lists which servers read each format.
Limits
- Formats are the seven that Apache's htpasswd writes, plus
$2a$and{PLAIN}. Checking also reads$1$MD5 crypt and{SSHA}; yescrypt ($y$), scrypt and$2x$are recognised but cannot be checked in the browser. - bcrypt cost is 4–17 (the APR limit); SHA-2 rounds are 1,000–1,000,000 here. At cost 17 bcrypt takes many seconds in a browser.
- The file editor works on text; it does not write to your server.
- Digest authentication files (
htdigest) use another format and are not supported.
FAQ
Which htpasswd format should I use?
bcrypt $2y$ if the server can read it: Apache 2.4 reads it on every platform, and Nginx reads it where the system crypt() supports bcrypt (Debian 11 and later, Ubuntu 20.04 and later, Alpine, AlmaLinux 9 in our tests). On CentOS 7 or Ubuntu 18.04 Nginx cannot read bcrypt; use SHA-512 crypt there. APR1 is the one format every Apache and Nginx build reads.
Why does the tool write $2y$ and not $2a$?
$2y$ is what Apache's own htpasswd -B writes and what the Apache Password Formats page documents. The hash is the same; only the prefix differs. Pick $2a$ only for OpenBSD, whose crypt() accepts $2a$ and $2b$ but not $2y$. Avoid $2b$ for Apache: APR handles $2a$ and $2y$ itself and passes $2b$ to the system crypt(), which fails on macOS and Windows.
What bcrypt cost should I choose?
htpasswd uses 5 by default and accepts 4 to 17. This tool starts at 10. Basic authentication sends the password with every request, so the server runs bcrypt on every request: on an Apple M1 Max one htpasswd -v check took about 13 ms at cost 5, 72 ms at cost 10 and 266 ms at cost 12. Pick the highest cost your request rate can afford.
Can the password contain non-ASCII characters?
Yes. The tool hashes the password as UTF-8, so the client must send it as UTF-8 too. Chinese, Japanese and Korean passwords sent with curl -u from a UTF-8 terminal worked on both Apache and Nginx in our tests. The tool shows how many UTF-8 bytes a password takes; bcrypt uses only the first 72, and a Chinese, Japanese or Korean character takes 3, so it warns when a bcrypt password is longer than that.
Are my passwords sent to a server?
No. Hashing runs in this browser tab with bcrypt.js and the page's own code; nothing is uploaded or stored, and the page loads no analytics or ad scripts. You can check this in the browser's network panel while you generate.
Can I use the plain text format?
Only in narrow cases. Apache accepts plain text passwords only on Windows and NetWare (htpasswd manual, -p). Nginx reads plain text only with the {PLAIN} prefix, which its documentation describes as an example that should not be used. On Linux Apache a plain text line never matches.