CompleteSEOTools
Home › Security & Passwords › Htpasswd Generator

Htpasswd generator

Create a user:hash line for an Apache .htpasswd file, or test whether a password matches a hash you already have.

About Htpasswd Generator

Apache basic authentication reads users and password hashes from a .htpasswd file. This page writes those lines for you. Pick bcrypt, which is the safest choice and works in Apache 2.4, APR1-MD5, the long-standing Apache default, or the old SHA-1 form. A second tab checks a password against an entry you paste. The hashing code runs in your browser, so the password does not travel to a server.

  • Protecting a staging site or an admin folder with a login.
  • Adding a user to an existing .htpasswd file without shell access.
  • Checking which password belongs to an old entry.
  • Switching an old APR1 file over to bcrypt.

How to use Htpasswd Generator

1

Step 1

Enter a user name and a password, and pick the method.

2

Step 2

Press Create entry and copy the line.

3

Step 3

Paste it into your .htpasswd file, one user per line.

Good to know

  • bcrypt reads only the first 72 bytes of a password. Longer ones are cut off.
  • A higher bcrypt cost is slower to crack and slower to calculate. Cost 10 is a sensible default and each step up doubles the time.
  • A .htpasswd file should sit outside the public web folder, or be blocked by a rule, so nobody can download it.

Common questions

Which method should I choose?

bcrypt if your server supports it. APR1-MD5 works everywhere Apache does. SHA-1 without a salt is weak and only worth using when nothing else is accepted.

Why is the same password different each time?

A random salt is mixed in. Both lines are valid. Use the optional salt box to repeat a result.

Does Nginx accept these lines?

Mostly. Nginx reads the same file format. APR1-MD5 and SHA-1 lines always work, and bcrypt lines work when the server's crypt library supports them.