UtilitySansar

htpasswd Generator

Generate .htpasswd entries for Apache and Nginx Basic Auth (APR1-MD5 or SHA-1). Build multi-user files and use the setup guide below to protect folders quickly.

Use this tool to create username:hash lines for .htpasswd files. Add multiple users, download a complete file, then apply the Apache or Nginx configuration snippets on this page to protect a folder with HTTP Basic Authentication.

Colons are not allowed in usernames.

Hashing algorithm

Salted, 1000-round MD5 variant ($apr1$…). Apache's default — the most portable choice.

Enter a username and password above to generate the .htpasswd line.

How to configure Apache or Nginx
  1. 1. Save the .htpasswd file
    Place it outside your web root, e.g. /etc/apache2/.htpasswd
  2. 2. Add to your VirtualHost or .htaccess
    <Directory "/var/www/html/protected">
        AuthType Basic
        AuthName "Restricted Area"
        AuthUserFile /etc/apache2/.htpasswd
        Require valid-user
    </Directory>
  3. 3. Reload Apache
    sudo systemctl reload apache2

FAQ

All hashing happens locally in your browser. Your credentials are never transmitted.