Loading...

Htpasswd Generator

Htpasswd is a command-line tool used to create and update the flat-files used to store usernames and passwords for basic authentication of HTTP users in Apache web servers. This tool generates htpasswd entries compatible with Apache HTTP Server.

Generate Htpasswd Entry
Bcrypt is the most secure option and recommended for new installations.
How to use?

Copy the generated entry and paste it into your .htpasswd file. Each line should contain one username:password pair. Place the .htpasswd file in a secure location outside your web root.

Verify Htpasswd Entry
Htpasswd Entry Format

Htpasswd entries follow the format:

username:password_hash

Different algorithms have different hash formats:

  • Bcrypt: $2y$ prefix
  • MD5: $apr1$ prefix
  • SHA-1: {SHA} prefix
  • Crypt: No prefix (DES)
Security Information

Important notes about Htpasswd:

  • Store .htpasswd files outside your web document root for security.
  • Use Bcrypt algorithm for new installations - it's the most secure option.
  • MD5 with Apache salt ($apr1$) is acceptable for legacy systems.
  • Avoid SHA-1 and Crypt (DES) for new installations - they're less secure.
  • This tool processes all data in your browser - no credentials are sent to our server.
  • Regularly update passwords and use strong, unique passwords for each user.
Apache Configuration

To use .htpasswd file in Apache, add this to your .htaccess or virtual host configuration:

AuthType Basic
AuthName "Restricted Area"
AuthUserFile /path/to/.htpasswd
Require valid-user

Replace /path/to/.htpasswd with the actual path to your .htpasswd file.

About Htpasswd Generator

Generate and verify htpasswd entries for Apache HTTP Server basic authentication with multiple hash algorithms

Create a username:hash entry for Apache HTTP Basic Authentication and verify credentials against compatible hashes.

Key features

  • Security task Create a username:hash entry for Apache HTTP Basic Authentication and verify credentials against compatible hashes.
  • Required material Enter a Basic Auth username and password; avoid colons or line breaks that would corrupt the htpasswd record.
  • Parameters that must match Choose a hash scheme supported by both the tool and target Apache deployment, then set its cost where applicable.
  • Result and verification Copy the generated single-line entry into a protected .htpasswd file and reference it from the web-server configuration.

How to use Htpasswd Generator

Follow this workflow to work with Apache htpasswd entries safely and accurately.

  1. Provide the required material Enter a Basic Auth username and password; avoid colons or line breaks that would corrupt the htpasswd record.
  2. Match security parameters Choose a hash scheme supported by both the tool and target Apache deployment, then set its cost where applicable.
  3. Run the operation Run the operation locally, keep sensitive Apache htpasswd entries out of logs and screenshots, and never assume a successful transformation proves secure deployment.
  4. Verify before use Copy the generated single-line entry into a protected .htpasswd file and reference it from the web-server configuration.

Usage tips

  • Store .htpasswd outside the public document root and restrict filesystem permissions.
  • Serve Basic Auth only over HTTPS because credentials are merely Base64-encoded in transit.
  • Prefer bcrypt where the deployed Apache version supports it; avoid cryptographically weak legacy schemes.

Frequently asked questions

Create a username:hash entry for Apache HTTP Basic Authentication and verify credentials against compatible hashes.
Enter a Basic Auth username and password; avoid colons or line breaks that would corrupt the htpasswd record.
Choose a hash scheme supported by both the tool and target Apache deployment, then set its cost where applicable.
Hash support differs by Apache build and operating system. Test the entry on the target server and keep authorization configuration separate from authentication.