Generate secure Apache htpasswd entries instantly — enter a username and password to get a properly salted APR1-MD5 hash line.
What is the Htpasswd Generator?
Apache and Nginx can password-protect a website or directory using HTTP Basic Authentication, and the credentials live in an htpasswd file — but the passwords in that file must be hashed, never stored in plain text. This generator produces a complete htpasswd line in the widely compatible APR1-MD5 format ($apr1$…): it creates a cryptographically random salt, runs the thousand-round APR1 hashing algorithm in your browser, and outputs “username:$apr1$salt$hash” ready to append to your .htpasswd file.
Because the salt is random, generating twice gives two different lines for the same password — both remain valid. The APR1 format works with Apache’s htpasswd utility and most hosting panels out of the box, which is why it remains the default recommendation for simple protection of staging sites, admin areas, and private directories. One important note: Basic Auth sends credentials with every request, so always serve protected areas over HTTPS, or the hashing is theater. Your password is hashed locally in JavaScript and never transmitted anywhere. Whether you are locking down a staging site or a private directory, a fresh salted line takes seconds to create.
How to use the Htpasswd Generator
- Type the username for the protected area.
- Enter the password (it is hashed in your browser; it is never sent anywhere).
- Click Generate to produce a salted APR1-MD5 htpasswd line.
- Copy the full “username:$apr1$…” line into your .htpasswd file.
- Protect the directory in Apache with AuthType Basic pointing at that file, and serve it over HTTPS.
Htpasswd Generator use cases
Staging sites
Lock a pre-launch site behind a simple login without building user accounts. One htpasswd file protects the whole staging domain from crawlers and curious visitors until you are ready to launch.
Admin panels
Add a first layer of protection in front of /admin or phpMyAdmin. Even if the application has its own login, the extra Basic Auth gate stops automated scanners cold before they reach your login form.
Client previews
Share one username and password with a client for reviewing work in progress. When the project launches, delete the file and the preview access disappears with it — no accounts to clean up.
Private directories
Guard downloads, documentation, or backups exposed through a web server. A single directory block in Apache plus one htpasswd line is all it takes to keep them private. Setup takes minutes, protection lasts indefinitely.
Learning server admin
Practice Basic Auth setup with correctly formatted credential lines. Generating real $apr1$ entries teaches the file format faster than reading docs alone, and you can verify each line against Apache immediately.
Tips
- Always use HTTPS with Basic Auth — without it, credentials travel essentially in the open.
- Generate a fresh line per user; never reuse the same hash across accounts.
- Store the .htpasswd file outside the web root so it can never be downloaded directly.
- APR1 is fine for low-traffic protection, but for high-security needs prefer bcrypt ($2y$) hashes if your server supports them.