SSL & Security
.htpasswd Generator
.htpasswd Generator
Create secure password files for Apache and Nginx
bcrypt (Recommended)
Modern, secure, and slow by designUsername for basic authentication
User password (will be hashed)
Tool features
Multiple Hash Algorithms
Secure Password Hashing
Multi-User Management
Ready to Deploy
What is .htpasswd & how it works
An .htpasswd file holds the usernames and hashed passwords for HTTP Basic Authentication on Apache (and Nginx, which reads the same file). Each line is username:hash; the server hashes the password a visitor types and compares it to the stored hash, so the plain password is never kept on disk.
Apache recognises the hash type from its prefix. $2y$, $2a$ or $2b$ is bcrypt, the strongest option and the one to use; $apr1$ is Apache's MD5-based format, weaker but supported everywhere. Basic Auth sends the credentials with every request, so only use it over HTTPS.
How to use this tool
Frequently asked questions
/etc/apache2/.htpasswd, so it can never be downloaded. Make it readable by the web server user only.AuthType Basic, AuthName "Restricted", AuthUserFile /path/to/.htpasswd and Require valid-user to the directory config or its .htaccess.auth_basic "Restricted"; and auth_basic_user_file /path/to/.htpasswd; in the location block. APR1 hashes always work; bcrypt works when the system crypt library supports it, as on most current distributions.htpasswd -cB /etc/apache2/.htpasswd alice (the -B flag selects bcrypt; drop -c when adding more users).