Htpasswd Generator

Enter a username and password, then click “Add” to create an htpasswd line.

Your text and files never leave your browser — nothing is sent to a server.

The list only lives on this page. Copy or download it before you leave.

How to use

  1. Enter a username and password. Click “Generate” to create a random 16-character password.
  2. Unless you have a reason not to, keep bcrypt as the algorithm. A cost of 10 is a sensible default.
  3. Click “Add to list” and a “user:hash” line is added on the right. Adding the same username again replaces its line.
  4. Save the contents as a .htpasswd file on your server and point your .htaccess or Nginx config at that file.

FAQ

Is my password sent to a server?

No. Hashes are created inside your browser and the password is never transmitted. The generated line does not contain the plain password either.

What goes in .htaccess?

Add four lines: AuthType Basic, AuthName "Restricted", AuthUserFile /absolute/path/to/.htpasswd and Require valid-user. Keep the .htpasswd file outside your public web folder.

Why is the result different every time for the same password?

bcrypt and APR1 mix in a random salt on every run. The salt is stored in the line, so the server can still check the password — any of the lines will work.

Related tools

All tools