htpasswd Generator
runs in your browserno sign-upfree
Create .htpasswd lines for Apache and Nginx basic auth with bcrypt, Apache MD5 or SHA-1, plus .htaccess and Nginx config. Passwords stay in your browser.
Users
Server setup
Keep the .htpasswd file outside your website folder if you can, so it can’t be downloaded.
Check a password against an htpasswd file
About this tool
Password-protect a folder or a whole site on Apache or Nginx with HTTP basic authentication. Enter one or more usernames and passwords and this tool creates the .htpasswd file — the same lines the htpasswd command writes — using bcrypt, Apache MD5 ($apr1$) or SHA-1. It also gives you the .htaccess or Nginx configuration to paste, and can check whether a password matches an existing htpasswd line. Passwords are hashed in your browser and never sent anywhere.
How to use
- Choose the encryption — bcrypt is best for any current server.
- Enter a username and password (or press the dice for a strong one); add more users if needed.
- Press Create htpasswd, then copy or download the .htpasswd file and upload it to your server.
- Copy the Apache or Nginx configuration, set the file path, and add it to your server.
FAQ
Which encryption should I use?
bcrypt. It is supported by Apache 2.4+ and by Nginx on Linux systems with a modern crypt library, and it is far harder to crack. Use Apache MD5 ($apr1$) only for very old servers, and SHA-1 only if a legacy system needs it — it has no salt.
Are these the same as the htpasswd command’s output?
Yes. The lines use the same formats as `htpasswd -B` (bcrypt), `htpasswd -m` (Apache MD5) and `htpasswd -s` (SHA-1), and were checked against the real htpasswd command, which accepts them. Each hash uses a random salt, so it looks different every time — that is expected.
Where do I put the .htpasswd file?
Anywhere the web server can read it, ideally outside the public website folder (for example /etc/apache2/.htpasswd or /etc/nginx/.htpasswd), and give its full path in the configuration. If it must sit inside the site, make sure the server refuses to serve it — Apache does this for files starting with .ht by default.
Is basic authentication secure?
Only over HTTPS: the browser sends the username and password with every request, so without HTTPS anyone on the network could read them. With HTTPS and a strong password it is fine for admin areas, staging sites and internal tools.
Are my passwords sent to a server?
No. Hashing happens entirely in your browser, and nothing you type is saved. Many htpasswd generators process passwords on their server — this one doesn’t.