Skip to main content
KalkuNet

.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.

Runs in your browserWeb · Security & Privacy
Hash algorithm:

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.

AlgorithmApache 2.4Nginx
bcrypt $2y$✓✓ when the system crypt() supports bcrypt (libxcrypt: Debian 11+, Ubuntu 22.04+, Fedora, Alpine)
$apr1$✓✓ built into Nginx
{SHA}✓✓ (weak, unsalted)
Apache (.htaccess or <Directory>)
Nginx

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.

Learn more