# Htpasswd Generator

Create htpasswd lines for HTTP basic authentication in Apache, nginx and other servers. Enter one user and password per line as user:password and choose bcrypt, Apache MD5 (apr1) or SHA-1, then copy the lines into your .htpasswd file.

## Frequently asked questions

### Which algorithm should I use?

bcrypt. It is the slowest to crack and supported by Apache 2.4 and nginx on most systems. Apache MD5 (apr1) works everywhere htpasswd files are read but is much weaker, and SHA-1 without a salt should only be used for compatibility with old software.

### How do I enter users?

One user per line, written as the user name, a colon and the password, for example alice:correct horse battery staple. The password may contain colons and spaces; everything after the first colon is used.

### Does it match Apache's htpasswd tool?

Yes. bcrypt lines use the $2y$ prefix and cost 10 like htpasswd -B, apr1 lines use the same algorithm and salt alphabet as htpasswd -m, and SHA-1 lines use the {SHA} prefix like htpasswd -s.

### Is there a password length limit?

bcrypt uses only the first 72 bytes of a password, so the tool refuses longer passwords for bcrypt instead of silently truncating them. The other algorithms accept any length.

### How do I use the lines in nginx?

Save them in a file such as /etc/nginx/.htpasswd and add auth_basic and auth_basic_user_file to the location you want to protect. Basic authentication sends the password with every request, so use it only over HTTPS.

### Are the passwords stored?

No. They are hashed for this request and only the resulting lines are returned.

Your ad here?

[Email us](mailto:hi@dennn.is?subject=Advertising%20on%20OneClick%20Pro)

[Ad 433 tools for your AI agents through one MCP server.](https://multitaskai.com/?ref=oneclickpro)
