Server

.htpasswd Generator

Build a user:hash line for HTTP basic auth in Apache or Nginx. Hashing runs entirely in your browser — the password is never sent anywhere. Pairs with the Nginx / Apache config generator.

For a new setup prefer bcrypt (htpasswd -B) — it isn't offered here because it needs a native implementation. apr1 is still widely supported and far stronger than plain SHA-1.

Creating .htpasswd entries

An .htpasswd file holds user:hash lines for HTTP basic authentication in Apache and Nginx. This generator hashes the password in your browser (apr1-MD5 or SHA-1) and outputs a line you can append to the file.

Frequently asked questions

How do I protect a location in Nginx?

Add auth_basic "Restricted"; and auth_basic_user_file /etc/nginx/.htpasswd; inside the location block, then reload Nginx. Always serve basic-auth pages over HTTPS.

How do I create the file on the server instead?

htpasswd -c /etc/nginx/.htpasswd alice (from apache2-utils or httpd-tools). Omit -c when adding further users, or the file is overwritten.

Further reading

All Utilities tools →