.htpasswd Generator — bcrypt, APR1-MD5 and SHA Hashes for Apache and Nginx
Create .htpasswd lines with bcrypt, APR1-MD5 or {SHA} hashes that Apache and Nginx accept, with secure random passwords and a password checker.
Random password: 20 characters from crypto.getRandomValues (≈ 120 bits). Every hash also has a random salt, so the result differs each time — that is expected.
Browsers cannot save a file name that starts with a dot: after downloading, rename htpasswd.txt to .htpasswd and keep it outside the site's public folder.
| Algorithm | Apache 2.4 | Nginx |
|---|---|---|
bcrypt $2y$ | ✓ | ✓ when the system crypt() supports bcrypt (libxcrypt: Debian 11+, Ubuntu 22.04+, Fedora, Alpine) |
$apr1$ | ✓ | ✓ built into Nginx |
{SHA} | ✓ | ✓ (weak, unsalted) |
Check a password against an .htpasswd line
When to use the Apache/Nginx .htpasswd Hash Line Generator
Hashes servers accept
bcrypt ($2y$), APR1-MD5 ($apr1$) and {SHA} are computed with the same algorithms as Apache's htpasswd command, and each kind is tested with Apache's own htpasswd -v.
Safe randomness
Salts and random passwords come from crypto.getRandomValues, not Math.random, with unbiased sampling. A random 20-character password is worth about 120 bits.
Many users at once
Add several users, choose the bcrypt cost, then copy or download every line. Names with a colon or a space, or duplicates, are flagged at once.
Check a password
Paste a line from an existing .htpasswd file to confirm the password you remember really matches, without logging in to the server.
Frequently asked questions
Which algorithm should I choose?
bcrypt when the server supports it: it is deliberately slow, so it is hard to crack. APR1-MD5 for Nginx on older systems. {SHA} only for compatibility, because it has no salt.
Does Nginx support bcrypt?
Nginx uses the system crypt() function for bcrypt. Debian 11+, Ubuntu 22.04+, Fedora and Alpine support it; otherwise use APR1-MD5, which Nginx handles itself.
Which cost is right?
10 is a good starting point. Each step of 1 doubles the work, for attackers and for the server alike; do not go too high, because the server computes it on every request.
Why does the result change every time?
Every hash uses a new random salt. Different hashes for the same password are normal and are exactly what stops table attacks.
Similar tools
- Browser Fingerprint & Entropy Privacy TestAudit exposed Canvas, WebGL, timezone, screen & hardware traits in your browser.
- Live localStorage & sessionStorage InspectorInspect keys and byte footprint stored locally on this origin in your browser.
- X.509 SSL/TLS Certificate (PEM) DecoderDecode X.509 certificates (PEM or DER): subject, issuer, SANs, validity and expiry, key type and size, extensions, SHA-256 fingerprint and the chain signature.
- Certificate Signing Request (CSR) DecoderDecode a PKCS#10 CSR: subject, requested SANs, key type and size, signature algorithm, and verify its signature before sending it to a CA.