Skip to content

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.

Reset

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.

About OneClick Pro

OneClick Pro is a free collection of more than 150 web tools for everyday work: converting images and units, formatting and validating code, checking domains and SEO, and working with text, dates and numbers. Every tool runs without registration or subscription, and what you enter is only used to calculate your result and is never stored. Use it as a quick toolbox for one-off tasks, or bookmark the tools you rely on every day.