HTACCESS Password Generator

Generate an Apache .htpasswd line for HTTP Basic Auth. It uses the legacy unsalted SHA-1 scheme, which works for compatibility but is weak by modern standards.

Security Tools● Free No upload Instant

Loading HTACCESS Password Generator…

Your browser is preparing the tool. It runs 100% locally.

Quick answer

Enter a username and password and the tool builds an Apache .htpasswd line for HTTP Basic Auth: the username, then {SHA} followed by the Base64 of the password's SHA-1 hash. It is ready to paste into a password file. Be aware that the {SHA} scheme is unsalted SHA-1, included for legacy compatibility but weak by modern standards, where bcrypt is recommended. It all happens in this tab, and nothing is uploaded.

What the HTACCESS Password Generator does

This tool generates a single line for an Apache .htpasswd file, the credential store behind HTTP Basic Authentication. It takes a username and password and outputs the line in the {SHA} format that Apache understands, so you can drop it straight into your password file.

Use it to add or update a Basic Auth user without running the htpasswd command-line tool, when all you need is a line to paste into a server config.

How it works

The password is hashed with SHA-1 using the browser's cryptography, and the raw digest is Base64-encoded. The tool then assembles the line as the username, a colon, the marker {SHA}, and that Base64 digest. That is the format Apache reads for this scheme.

When a visitor logs in, Apache hashes the password they enter the same way and compares it to the stored value. The catch is that the {SHA} scheme uses a plain, unsalted SHA-1: there is no per-password salt and no slowness, which is why it is considered weak today.

Generation algorithm

  1. Take username and password. Read the username and the password you want to store.
  2. Hash the password. Compute the SHA-1 digest of the password using the browser's cryptography.
  3. Base64-encode the digest. Encode the raw SHA-1 bytes as Base64.
  4. Assemble the line. Output username, a colon, the {SHA} marker and the Base64 digest, ready to paste.

What it outputs

line = username + : + {SHA} + base64( SHA-1( password ) ) Apache reads this from a .htpasswd file for HTTP Basic Auth
Worked example
admin / changeme → admin:{SHA}+pvrmeQCmtWmYVOZ57uuITVghrM=

The {SHA} scheme is an unsalted SHA-1. Apache supports it for legacy compatibility, but it is weak. For new setups, use bcrypt (htpasswd -B), which is salted and deliberately slow.

Privacy

Your browser processes the username and password on your device and makes no network request with them.

Because the hashing is local, the password is not transmitted while you generate the line. Still, store the resulting file securely and serve the protected area over HTTPS, since Basic Auth sends credentials with each request.

The tool keeps nothing between sessions. Close the tab and the inputs and output are gone.

Standards & references

  • HTTP Basic Authentication: A simple authentication scheme in which the server checks a username and password against a credential file. Apache reads these from a .htpasswd file referenced by a .htaccess or server config.
  • The {SHA} scheme: An entry of {SHA} followed by the Base64 of an unsalted SHA-1 digest. Apache supports it, but the lack of a salt makes it vulnerable to dictionary and rainbow-table attacks. It exists mainly for legacy compatibility.
  • bcrypt is recommended: For new Basic Auth setups, Apache and OWASP recommend bcrypt (htpasswd -B). It adds a salt and an adjustable cost factor that make password guessing expensive.

Accuracy and limits

The line is in the correct {SHA} format that Apache reads, so it works for HTTP Basic Auth as-is. For getting a user into a password file quickly, that is enough.

The security is the weak point. The {SHA} scheme is an unsalted SHA-1: every instance of the same password produces the same digest, which makes it vulnerable to precomputed dictionary and rainbow-table attacks. It is supported for compatibility, not because it is strong.

There is no salt and no slowness, the two properties that make password hashes hard to crack. A modern setup should use bcrypt instead. This tool does not produce it; use the htpasswd command with the bcrypt option.

Basic Auth itself sends the username and password with every request, encoded but not encrypted. Always serve a Basic-Auth-protected area over HTTPS so those credentials are not exposed on the network.

Where people use it

Adding a Basic Auth user

Generate a line to paste into an Apache .htpasswd file.

Quick server protection

Password-protect a folder without running the command-line tool.

Legacy compatibility

Produce a {SHA} entry for a system that expects it.

Learning Basic Auth

See how a .htpasswd credential line is built.

When it fits, and when it doesn't

Good for

  • Generating a {SHA} .htpasswd line
  • Quick Apache Basic Auth setup
  • Legacy systems expecting {SHA}
  • Learning how the credential file works

Not the best choice for

  • A strong, modern credential (use bcrypt)
  • Storing high-value passwords
  • Anything without HTTPS in front of it
  • Salted or slow password hashing

For a strong entry, generate a bcrypt line with the htpasswd command (the -B option) or a bcrypt-capable tool, since bcrypt is salted and slow. Always put HTTPS in front of a Basic-Auth-protected area, whatever the hash.

Frequently asked questions

What does this tool generate?
A single Apache .htpasswd line in the {SHA} format: the username, a colon, the marker {SHA}, and the Base64 of the password's SHA-1 hash. You paste it into your password file for HTTP Basic Auth.
Is the {SHA} scheme secure?
Not by modern standards. It is an unsalted SHA-1, so the same password always hashes the same way, leaving it open to dictionary and rainbow-table attacks. Apache keeps it for legacy compatibility; bcrypt is the recommended choice.
What should I use instead for strong security?
bcrypt, which you generate with the htpasswd command and its bcrypt option. bcrypt adds a salt and an adjustable cost factor, making password guessing far more expensive than an unsalted SHA-1.
Where does the line go?
Into a .htpasswd file on your server, which a .htaccess file or the server configuration points to for the protected area. Apache checks logins against it.
Why is unsalted hashing a problem?
Without a per-password salt, identical passwords produce identical hashes, so an attacker can precompute hashes (rainbow tables) and match many accounts at once. A salt makes each hash unique and defeats that.
Is the password sent anywhere when I generate the line?
No. Your browser does the hashing, so the password is not transmitted while you create the line. Store the resulting file securely afterwards.
Does Basic Auth encrypt the password in transit?
No. Basic Auth sends the username and password Base64-encoded but not encrypted with each request. You must serve the protected area over HTTPS so they are protected on the network.
Can I use this line with Nginx?
Nginx can read Apache-style password files, and it supports several schemes. The {SHA} format may work, but for a new setup prefer a bcrypt entry, which both servers handle and which is far stronger.
Why is the hash shown in Base64?
The {SHA} scheme stores the raw SHA-1 digest encoded as Base64, which is the format Apache expects after the {SHA} marker. The Base64 is just how the binary digest is written as text.
Can I add multiple users?
Each user is one line in the .htpasswd file. Generate a line per user and add them all to the file; Apache reads each username and its stored hash.
Does the username get hashed too?
No. Only the password is hashed. The username is stored in plain text at the start of the line, before the colon and the {SHA} digest.
Is a longer password safer here?
A longer password helps against guessing, but the scheme's weakness is the lack of a salt and slowness, not length. Even with a long password, bcrypt is the stronger choice for storage.

References

Builds a username and {SHA} entry (Base64 of an unsalted SHA-1 of the password). This legacy scheme is weak, and bcrypt is the modern recommendation.

PopularHot

Password Generator

A random password at the length and character mix you set.

SecurityOpen
Popular

Password Strength Checker

An entropy estimate in bits, with tips to make it stronger.

SecurityOpen
Popular

Random Number Generator

Whole numbers in any range from a cryptographic source.

SecurityOpen
Trending

SHA-256 Hash Generator

The SHA-256 hash of any text, computed in your browser.

SecurityOpen
Trending

Passphrase Generator

Random words joined into a passphrase you can remember.

SecurityOpen

MD5 Hash Generator

The MD5 checksum of any text.

SecurityOpen

Back to the HTACCESS Password Generator

Your browser generates and checks everything locally, so nothing secret is sent. No account needed.