htpasswd Generator

htpasswd Generator

For bcrypt ($2y$) use the CLI: htpasswd -B. SSHA/SHA work with Nginx and Apache. Everything is computed locally in the browser – no password leaves your machine.

How the htpasswd generator works

The tool generates a ready-to-use .htpasswd line in the format user:hash for HTTP basic authentication. The computation runs entirely in the browser via the Web Crypto API – username and password are never transmitted.

  • SSHA (recommended): Salted SHA-1 hash. Thanks to the random salt, the same password produces a different hash every time – far more resistant to rainbow tables.
  • SHA: Unsalted SHA-1 hash in {SHA} format. Simple, but without a salt.
  • Compatibility: Both formats are understood by Nginx (auth_basic) and Apache.
  • bcrypt: For $2y$ hashes (Apache only) use htpasswd -B user on the command line.

Using it in Nginx: place the file at /etc/nginx/.htpasswd and set auth_basic "Restricted"; and auth_basic_user_file /etc/nginx/.htpasswd; in the server block.

Related tools

Scroll to Top