Htpasswd Generator

Generate an .htpasswd entry to password-protect a directory on an Apache server.

Simple protection for a directory

On Apache servers, an .htpasswd file holds usernames and hashed passwords used to lock a directory behind a login prompt — the simplest way to put basic protection on an admin area, a staging site, or a private folder. This generates a correctly-hashed .htpasswd entry from a username and password, so you can add it without running the command-line tool.

Enter a username and password and the .htpasswd line is generated.

Hashed, and best over HTTPS

The password in an .htpasswd file is hashed, not stored in plain text, which is why you generate an entry rather than just typing the password into the file. Two things are worth knowing: this protection uses HTTP Basic Auth, so it should sit behind HTTPS to keep the login itself encrypted in transit, and it is simple gatekeeping suitable for low-stakes protection rather than a substitute for proper application authentication on anything sensitive. For quickly walling off a staging site, though, it is exactly the right tool.

Frequently asked questions

Why generate an entry instead of typing the password?

The file stores a hashed password, not plain text, so the entry must be correctly hashed rather than written directly.

Is .htpasswd protection secure enough?

It is simple gatekeeping best used behind HTTPS for low-stakes protection, not a replacement for proper application authentication.

Is my password uploaded?

No. The entry is generated in your browser.

More Developer tools