.htpasswd Generator & Checker (bcrypt Password File for Basic Auth, with Nginx, Caddy and Traefik Config)
Completely free, with no extra charges. You may freely use the output commercially.
About this tool
This tool is for anyone who wants to put Basic authentication on an admin area or a staging site and needs .htpasswd lines without running the htpasswd command on a server. Enter a username and password, and it hashes them with bcrypt, APR1-MD5, SHA-512 crypt and other formats, and also gives you ready-to-paste config for Apache (.htaccess), Nginx, Caddy and Traefik (a dynamic config file and Docker Compose labels).
Load an existing .htpasswd to add users, change passwords or remove users and write the file back, or check whether a password matches a line. The lines use the same format as Apache’s htpasswd command, and the tool warns you when a server cannot read the format you picked. Because it handles passwords, all processing happens entirely in your browser (no data is sent).
Enter users and passwords
Advanced settings for the server config
Add to or edit an existing .htpasswd (optional)
Your .htpasswd and config examples
Check whether a password matches
When a login fails, check whether a .htpasswd line matches the password you remember. If you loaded an existing .htpasswd above, you can pick the user from it.
How to use it and how the formats differ
Setting up Basic authentication from scratch
- Enter a username, then either press “Generate” for a password or type your own. To give access to several people, use “Add user” to add one row per person.
- Keep bcrypt for Apache, Caddy and Traefik; for Nginx on an older OS, choose APR1-MD5 or SHA-512 crypt. The table shows whether each server can read the format.
- Press “Create .htpasswd”, then “Save .htpasswd” to get the file. On Apache and Nginx, put it outside the public web directory (for example /etc/nginx/.htpasswd) where the web server user can read it.
- Copy the config example from the tabs into your server config and reload it (for Nginx, check with
nginx -t, then runnginx -s reload). Caddy and Traefik take the lines inside the config itself, so no file is needed.
Adding users or changing a password later
Open “Add to or edit an existing .htpasswd”, paste the current file, enter the users you want to add (or change) in the fields above, and create the file. A line with the same username is replaced in place, and new users go at the end. Users you take out with “Remove” in the table are left out of the output. Other users keep their hashes unchanged, so it does not matter if you don’t know their passwords.
Which format to choose
- bcrypt (
$2y$): designed to be slow to compute, so it holds up well against brute force if the file leaks. The output matches Apache 2.4’shtpasswd -B. Each step of cost doubles the work; htpasswd defaults to 5 and this tool to 10. - APR1-MD5 (
$apr1$): the htpasswd command’s default, readable by Apache, Nginx and Traefik alike. It only repeats MD5 1,000 times, so it is weaker against brute force than bcrypt. - SHA-512 crypt (
$6$) and SHA-256 crypt ($5$): Linux crypt() formats that Nginx and Apache on Linux can read. Caddy and Traefik cannot. - {SHA}: unsalted SHA-1, so the same password always gives the same value. Use it only when you need compatibility with an old system.
Things to keep in mind
- Basic authentication sends the password with every request, only Base64-encoded. Always use it on an HTTPS site.
- bcrypt uses only the first 72 bytes of a password (accented and non-Latin characters take 2–4 bytes each). The tool warns you about longer passwords.
- The checker supports bcrypt, APR1-MD5, MD5 crypt (
$1$), SHA-256/512 crypt, {SHA}, {SSHA} and plain text. The 13-character legacy DES crypt only uses the first 8 characters of a password, so it is not checked and the tool suggests recreating it. - A username cannot contain “:”. If several lines share a username, the server uses only the first one.
- Recreating a hash gives a different string every time, even for the same password, because the salt changes. All of them accept the same password.
The steps I tested on a real Nginx server, and how to read the error log when you cannot log in, are in the article “Create an .htpasswd File Without the htpasswd Command”.
Sources
- Apache HTTP Server 2.4: htpasswd / Password Formats
- nginx: ngx_http_auth_basic_module
- Caddy: basic_auth
- Traefik: BasicAuth
- Unix crypt using SHA-256 and SHA-512 (Ulrich Drepper)
Checked against each project’s documentation as of December 2026. bcrypt is computed with bcrypt.js (BSD-3-Clause).