Free .htpasswd Generator Online

Create .htpasswd files online for Apache and Nginx basic auth. Bcrypt ($2y$) or legacy {SHA} hashes, multiple users, random passwords and an .htaccess snippet.

  • No upload, 100% private
  • Instant, in your browser
  • 100% free, no signup
Loading tool…
Read the complete guideHow to Password Protect a Site or Folder With .htpasswd →

About the .htpasswd Generator tool

HTTP Basic Authentication is the quickest way to put a password on a staging site, an admin folder or an internal tool. Apache reads usernames and password hashes from an .htpasswd file, and Nginx’s auth_basic_user_file directive uses the same format. Without shell access you cannot run the htpasswd command, so this generator creates the file for you.

Add as many users as you need, type a password for each or click the shuffle button to create a random 16-character one, then choose the hash algorithm. bcrypt, written with Apache’s $2y$ prefix and an adjustable cost factor, is the recommended choice and is supported by Apache 2.4 and by Nginx on systems whose crypt library supports bcrypt. For very old servers you can instead produce {SHA} entries, which are unsalted SHA-1 hashes encoded in Base64. The tool checks that usernames have no colons or spaces and are not duplicated.

The result is one user:hash line per user, ready to copy or download. Below it, an .htaccess snippet with AuthType Basic, AuthName, AuthUserFile and Require valid-user is filled in with the server path you enter. Hashing happens in your browser.

How to use .htpasswd Generator

  1. Enter a username and password for each account, using “Add user” for more rows or the shuffle button for a random password.
  2. Choose a “Hash algorithm”: bcrypt ($2y$) or SHA-1 ({SHA}), and set the bcrypt “Cost factor”.
  3. Click “Generate .htpasswd” and copy or download the result.
  4. Enter the file’s full server path and copy the .htaccess snippet into the folder you want to protect.

Features

Multiple users

Build a complete .htpasswd file with any number of accounts in one go.

bcrypt with $2y$

Produces the same bcrypt format as Apache’s htpasswd -B command.

Legacy {SHA} option

SHA-1 entries for old servers, calculated with the Web Crypto API.

Random passwords

One click generates a strong 16-character password per user.

Ready .htaccess snippet

Copy the matching Basic Auth configuration with your file path filled in.

When to use it

  • Password-protect a staging site before a client review.
  • Lock down a /wp-admin or /admin folder with an extra login layer.
  • Add Basic Auth to an Nginx reverse proxy for an internal dashboard.
  • Create credentials for a shared download area on cPanel hosting.

Frequently asked questions

Where should I put the .htpasswd file?

Outside your public web root if possible, for example /home/user/.htpasswd, so it cannot be downloaded. Use the full absolute path in AuthUserFile.

Does Nginx support bcrypt in .htpasswd?

Nginx passes the hash to the operating system’s crypt function, so bcrypt works where that library supports it, as on most modern Linux distributions. If yours does not, use {SHA} or generate the file on the server.

Why is {SHA} called legacy?

It is a single unsalted SHA-1 hash, so identical passwords produce identical hashes and they can be cracked quickly if the file leaks. Use bcrypt whenever the server supports it.

Is Basic Authentication secure?

It sends credentials with every request encoded, not encrypted, so always use it over HTTPS. It is fine as an extra gate for staging and admin areas.

Why was the downloaded file renamed?

Some browsers and operating systems treat names starting with a dot as hidden or rename them. If that happens, rename the file to .htpasswd after uploading it.

Related tools