Skip to content

Basic auth header generator

Free, no sign-up Runs in your browser

Turn a username and password into an Authorization: Basic header, or decode a header back to its credentials. Runs in your browser; nothing is sent.

Direction
Header
The result appears here.
curl
A curl command with the header appears here.

Everything here runs in your browser. The credentials are not sent anywhere.

Everything you type here stays in your browser. Nothing is sent to HardenKit or to anyone else.

How to use the basic auth header generator

  1. Choose to generate a header or decode one.
  2. To generate, type the username and the password.
  3. Copy the header, or the curl command that uses it.
  4. To decode, paste a header line or the Base64 part.

About this tool

HTTP Basic authentication sends a username and a password with every request, in one header. The client joins them with a colon, encodes the result as Base64, and sends Authorization: Basic followed by that text. This tool builds the header from a username and password, with a ready curl command, and reverses a header back into its two parts.

The Base64 step is encoding, not encryption. It exists so that any characters survive inside a header, and anyone who sees the header can read the password in a second, as the decode mode shows. So Basic authentication is only acceptable over HTTPS, where TLS protects the header in transit, and the header itself must be treated as a password: kept out of logs, URLs, screenshots and tickets.

Two details cause real bugs. The username cannot contain a colon, because the server splits at the first one. And the character set was never fixed until RFC 7617 recommended UTF-8, so a password with an accented letter may fail against an old server that expects Latin-1. For anything new, prefer tokens that can be scoped and revoked.

Sources

Questions

How do I create a Basic auth header?

Join the username and password with a colon, Base64-encode the result, and put it after "Authorization: Basic ". For user "Aladdin" and password "open sesame" the header is Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==.

Is Basic authentication secure?

Only over HTTPS. The credentials are merely Base64-encoded, so on plain HTTP anyone on the path can read them. Even over HTTPS the password is sent with every request, which is why tokens are preferred.

How do I decode a Basic auth header?

Base64-decode the part after "Basic " and split the result at the first colon. What comes before is the username and the rest is the password. No key is involved.

How do I send Basic auth with curl?

Use curl -u username:password https://example.com/ and curl builds the header for you. To send a header you already have, use -H "Authorization: Basic ...".

Related tools