Toolnova
Developer Tools

Htpasswd Generator

Generate a ready-to-use .htpasswd entry for Apache or Nginx HTTP Basic Authentication — choose between the {SHA} scheme (SHA-1 base64) or plain text, all computed locally in your browser for free.

  • 100% free
  • No signup
  • Private — in your browser
  • No watermark
Live tool · runs in your browser
Highlights

Why use Htpasswd Generator?

  • Generates {SHA} hash entries using the browser's built-in Web Crypto API
  • Supports plain-text scheme for testing and compatibility checks
  • Zero server contact — credentials are never transmitted or stored
  • Output is copy-ready to paste directly into your .htpasswd file
Overview

About Htpasswd Generator

The .htpasswd file stores username/password pairs that protect web directories via HTTP Basic Authentication. Each line follows the format username:hash, where the hash format is determined by the scheme used. Apache httpd and Nginx support several schemes including {SHA} (SHA-1 hashed and base64-encoded), MD5-based APR1, and bcrypt. This tool generates {SHA} hashes using the Web Crypto API built into modern browsers, requiring no installation and no server round-trip.

Because bcrypt requires a deliberately slow algorithm that is impractical to run purely client-side at safe cost factors, this tool uses the {SHA} scheme for hashed output. While SHA-1 is weaker than bcrypt, it is still far safer than plain text and is supported by all common web servers. For production systems handling sensitive data, it is recommended to generate bcrypt entries using the server-side htpasswd command-line tool with the -B flag. This free tool is ideal for development environments, staging servers, and quick access control setups.

Step by step

How to use Htpasswd Generator

  1. 1

    Enter a username and password

    Type the username (no colons) and the password you want to protect your directory with.

  2. 2

    Choose a hash scheme

    Select {SHA} for a hashed entry compatible with Apache and Nginx, or Plain for a no-hash entry useful during testing.

  3. 3

    Generate and copy

    Click Generate to produce the htpasswd line, then copy it and paste it into your .htpasswd file on the server.

FAQ

Frequently asked questions

What is a .htpasswd file?

A .htpasswd file stores username and hashed password pairs for HTTP Basic Authentication. When placed in or referenced from your web server configuration, it restricts access to a directory, prompting visitors for a username and password.

What is the {SHA} scheme?

The {SHA} scheme stores a SHA-1 hash of the password encoded in base64, prefixed with {SHA}. Apache httpd and Nginx both support it. It is more secure than plain text but weaker than bcrypt or MD5-APR1, so it is best suited for low-sensitivity access control.

Why is bcrypt not supported?

Bcrypt is intentionally slow to resist brute-force attacks, which makes it impractical to compute at a safe cost factor purely in the browser without blocking the UI. For bcrypt entries, use the server-side command: htpasswd -B /path/to/.htpasswd username.

How do I add the generated entry to my server?

Copy the generated line and append it to your .htpasswd file on the server (one entry per line). Make sure your Apache VirtualHost or Nginx location block references the file with AuthUserFile and has AuthType Basic and Require valid-user set.

Is my password safe when using this tool?

Yes. All hashing is performed in your browser using the Web Crypto API. Your username and password are never sent to any server, logged, or stored in any way.

Can usernames contain special characters?

Most characters are allowed, but colons (:) are forbidden because the colon is the separator between the username and hash in the .htpasswd format. The tool will warn you if you include one.

Related developer tools

See all developer tools

Browse more free tools

Explore every category in our toolbox.