GrepBoardTools GrepBoard manuals ↗ Log ↗

Tools / Server config

htpasswd · bcrypt generator

Type a user name and password, pick a format, and get one user:hash line for .htpasswd.

What you type is calculated only in your browser and is not sent to a server.

🔒 The password never leaves this browser — the hash is computed here.

Each step doubles the work. 10 takes well under a second here; the server pays the same on every login.

What it does

Creates one user:hash line for the .htpasswd file that nginx's auth_basic_user_file and Apache's AuthUserFile read. The hash is computed inside this browser and the password is sent nowhere. The "Check a line" tab tells you whether an existing line matches a password.

Examples

FormatShape of the lineSame thing on the server
bcrypt (cost 10)admin:$2y$10$ + 53 charactershtpasswd -B -C 10 file admin
APR1-MD5admin:$apr1$ + 8-character salt + $ + 22 charactershtpasswd -m file admin (the default)
SHA-1admin:{SHA} + 28 Base64 charactershtpasswd -s file admin

bcrypt and APR1 put a random salt in every line, so the same password gives a different line each time. {SHA} has no salt and always gives the same line — one reason not to use it.

Common mistakes

  • htpasswd -c on an existing file — -c creates the file from scratch and drops every user already in it. Leave -c out from the second user on.
  • The same user on two lines — nginx and Apache read from the top and use only the first line with that name. To change a password, delete the old line.
  • bcrypt passwords longer than 72 bytes — only the first 72 bytes count. In UTF-8 a Hangul syllable is 3 bytes, an emoji 4.
  • .htpasswd inside the web root — nginx serves dot files like any other file. Keep it outside the web root, for example in /etc/nginx/.
  • Plain HTTP — basic auth only wraps the user name and password in Base64. Use it together with HTTPS.

How it was checked

Apache htpasswd 2.4.58 from Ubuntu 24.04 was unpacked without installing. 70 lines made by this tool (all three formats; Hangul, emoji, punctuation and empty passwords; 71, 72, 73 and 255 bytes) had to pass htpasswd -v, a password with its first character changed had to fail, and bcrypt passwords of 73 bytes or more had to pass with only their first 72 bytes. The other way round, lines from htpasswd -nbB, -nbm and -nbs had to pass this tool's check. bcrypt lines were checked again with Python bcrypt and the system libcrypt crypt() (the function nginx calls for bcrypt lines), and the nginx example passed nginx -t — 334 checks in total. bcrypt is computed by bcryptjs 3.0.3 (BSD-3-Clause), bundled unmodified.

FAQ

Which format should I pick: bcrypt, APR1-MD5 or SHA-1?

bcrypt. It is slow on purpose, so a leaked file is hard to brute-force. APR1-MD5 is htpasswd's default and is read by old servers too, but it is fast to compute. Avoid {SHA}: it is one unsalted SHA-1.

Does nginx read bcrypt lines?

Of the three formats here, nginx computes $apr1$ and {SHA} itself and hands $2y$ bcrypt to the system's crypt(). Ubuntu 24.04's libcrypt reads $2y$ (checked with this tool's lines). If nginx on another system cannot read a bcrypt line, use APR1-MD5.

Is my password sent to a server?

No. The hash is computed in this browser; the password and the result are not sent to any server and are not passed to the analytics or ads this site uses. See the privacy notice.