.htpasswd Generator
Generate an .htpasswd line with Apache's apr1 MD5 or {SHA} hash for Nginx auth_basic or Apache, with the server config to use it.
Free · No sign-up · Your inputs stay in your browser
Input
Generate an .htpasswd entry
Output
htpasswd line
.htpasswd
admin:…
Nginx
auth_basic "Restricted"; auth_basic_user_file /etc/nginx/.htpasswd;
Both Apache and Nginx (auth_basic_user_file) read apr1 and {SHA}. Neither is a strong hash; bcrypt is, and htpasswd -B writes it, but Nginx only reads bcrypt where the system crypt() supports it. Basic auth sends the password with every request, so only use it over HTTPS.
Runs in this browser. Nothing you paste is sent to a server.
About this tool
Method, assumptions, practical next steps, and limits.
Protecting a staging site
Basic authentication is a quick lock for staging environments and admin tools. In Nginx, ngx_http_auth_basic_module reads the file named by auth_basic_user_file; in Apache, AuthUserFile. Keep the file outside the document root.
The hashes
apr1 is MD5 iterated 1,000 times with a salt; {SHA} is a single unsalted SHA-1. Both are fast by modern standards, so use a long random password. htpasswd -B from apache2-utils writes bcrypt, which Apache always understands; Nginx reads it only where the system's crypt() library supports bcrypt, so test a login before relying on it.
Over HTTPS only
Basic auth sends the password, Base64-encoded, with every request. Without TLS anyone on the network reads it.