HTACCESS Password Generator

Generate an Apache .htpasswd line for HTTP Basic Auth in your browser. Honest note: it uses the legacy unsalted SHA-1 scheme — fine for compatibility, 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 runs entirely in your browser; 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.

It is the quick way to add or update a Basic Auth user without running the htpasswd command-line tool, handy when you just need 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 — the exact 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. It is supported for legacy compatibility but is weak — for new setups, bcrypt (htpasswd -B) is the recommended, salted and slow alternative.

Privacy

Your username and password are processed entirely on your device, with no network request, so nothing is uploaded.

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.

Nothing persists between sessions — close the tab and the inputs and output are gone.

Standards & references

  • HTTP Basic Authentication — A simple authentication scheme where 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 & Limitations

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, it does exactly what is needed.

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, which this tool does not produce — for that, the htpasswd command with the bcrypt option is the route.

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.

Real-World Use Cases

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 to use it — and when not to

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 — it 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 — generated with the htpasswd command using 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. The hashing happens entirely in your browser, 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); honest that this legacy scheme is weak and that bcrypt is the modern recommendation.

PopularHot

Password Generator

Password Generator computed locally with Web Crypto — your secrets never leave the page.

SecurityOpen Tool
Popular

Password Strength Checker

Use Password Strength Checker for stronger security hygiene — private, instant and free.

SecurityOpen Tool
Popular

Random Number Generator

Random Number Generator computed locally with Web Crypto — your secrets never leave the page.

SecurityOpen Tool
Trending

SHA-256 Hash Generator

SHA-256 Hash Generator computed locally with Web Crypto — your secrets never leave the page.

SecurityOpen Tool
Trending

Passphrase Generator

Passphrase Generator computed locally with Web Crypto — your secrets never leave the page.

SecurityOpen Tool

MD5 Hash Generator

Use MD5 Hash Generator for stronger security hygiene — private, instant and free.

SecurityOpen Tool

Ready to try the HTACCESS Password Generator?

It is free, private and runs entirely in your browser — no sign-up, no uploads, no limits.