Skip to content
My Tiny Utils

Search tools

Type to find a tool, then press Enter to open it.

Basic Auth Header Generator

Turn a username and password into an Authorization Basic header, a curl command, and a fetch snippet, or decode a Basic auth header back into its credentials.

Processed locally in your browser — nothing is uploaded.

Basic Auth Header Generator

May be empty. Shown in plain text — the header reveals it anyway.

Authorization header

Output appears here…

Token

Output appears here…

curl command

Output appears here…

fetch snippet

Output appears here…

Base64 is an encoding, not encryption: anyone who sees this header can decode the password. Send Basic auth only over HTTPS. Everything here runs in your browser.

About Basic Auth Header Generator

HTTP Basic authentication, defined in RFC 7617, sends a username and password with every request in a single header: the two are joined with a colon, encoded as UTF-8, then Base64-encoded, and sent as Authorization: Basic <token>. Enter a username and password and this tool builds the header, the bare token, a curl -u command quoted safely for bash and zsh, and a fetch() call that sends the header — ready to paste into a terminal, a test, or an API client.

Switch to Decode to go the other way: paste a whole Authorization: Basic … line, just the Basic … value, or the bare token, and see the username and password inside it. That is often the quickest way to check which account a script, a proxy config, or a captured request is using.

Base64 is an encoding, not encryption. Anyone who sees a Basic auth header can decode the password in a second, exactly as this tool does — so send Basic auth only over HTTPS, keep headers out of logs and screenshots, and prefer tokens you can revoke where an API offers them. This page builds and decodes everything in your browser; nothing you type is sent anywhere.

The username can't contain a colon, because the server splits the decoded text at the first colon — the tool stops you if you type one. The password may contain colons and may be empty, which some APIs use when the key goes in the username.

Common uses

  • Build the Authorization header for an API that uses HTTP Basic auth, such as a private package registry, a webhook endpoint, or a staging server
  • Get a correctly quoted curl -u command for a password full of $, !, and quotes
  • Decode a Basic header from a log, a config file, or browser dev tools to see which user it sends
  • Check that a client encodes non-ASCII credentials as UTF-8

Example

Input

Username: Aladdin
Password: open sesame

Output

Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==

curl -u 'Aladdin:open sesame' https://api.example.com/

This is the example from RFC 7617 itself; decoding QWxhZGRpbjpvcGVuIHNlc2FtZQ== gives back Aladdin and open sesame.

Limitations

  • Credentials are encoded as UTF-8, as RFC 7617 recommends; a server that doesn't advertise charset="UTF-8" in its challenge may expect another encoding for non-ASCII characters
  • When decoding, bytes that aren't valid UTF-8 are read as ISO-8859-1, which is what older clients sent
  • The curl command is quoted for POSIX shells (bash, zsh, sh), not for Windows cmd or PowerShell
  • It only builds and reads headers; it doesn't send a request or check that the credentials work

Frequently asked questions

How do I create a Basic auth header?

Join the username and password with a colon (user:pass), encode that text as UTF-8 and then Base64, and put the result after the word Basic: Authorization: Basic dXNlcjpwYXNz. This tool does all three steps as you type. In curl, -u user:pass builds the same header for you.

Is Basic authentication secure?

Only over HTTPS. Base64 is an encoding, not encryption, so anyone who can see the request can decode the password. Over HTTPS the header is encrypted in transit, but it is still sent with every request and can end up in logs, so rotate credentials if a header leaks and prefer revocable tokens where you can.

Can the username or password contain a colon?

The password can, but the username can't. The decoded text is split at the first colon, so a colon in the username would move part of it into the password. RFC 7617 forbids it for that reason.

Why does curl -u need a colon at the end for an empty password?

With -u user and no colon, curl prompts for a password. Writing -u user: (with the trailing colon) tells curl the password is empty, which is how APIs that take an API key as the username, with no password, are usually called.

How do I decode a Basic auth header?

Strip the Authorization: Basic prefix, Base64-decode the token, and split the result at the first colon: the part before is the username and the rest is the password. Paste the header into Decode and the tool does it, telling you if the token isn't valid Base64 or has no colon.

Is the password I type sent anywhere?

No. The header, snippets, and decoding are all computed in your browser, and nothing is transmitted or stored. Even so, treat any real password you paste into a web page with care.