Skip to main content
ZeroUtil

Basic Auth Header Generator

Create HTTP Basic Authentication headers from a username and password or API token.

Maintained by

How to use the Basic Auth Header Generator

  1. Type the username in the first field exactly as the API or server expects it. Common patterns are api-user, an account email, an OAuth client ID, or a literal username like admin for a router status page.
  2. Type the password or API token in the second field. Toggle Show if you want to verify there is no trailing space; the field re-encodes on every keystroke.
  3. Copy the Header line to drop straight into a -H flag, a Postman header, or a fetch headers object. Or copy the Base64 token alone if your client has a separate field for the encoded credentials.
  4. Paste and send. The header is the entire ready-to-use line: Authorization: Basic dXNlcjpzZWNyZXQ=. No extra wrapping or quoting needed.

What the generator does under the hood

The tool implements RFC 7617, the modern definition of HTTP Basic Authentication. It concatenates the username, a single colon, and the password into one UTF-8 string, then runs that through btoa() after a TextEncoder pass to handle non-ASCII characters correctly. The result is wrapped as Authorization: Basic <token>. Both pieces are exposed because some clients (older versions of curl, certain SOAP libraries, custom OAuth bridges) want the bare token.

Encoding happens on every keystroke and never leaves the page. There is no fetch call, no analytics ping with the credentials in tow, and no localStorage write. Refreshing the page wipes both fields. You can verify by opening DevTools, switching to the Network panel, and watching: nothing fires while you type.

When this tool earns its keep

  • Pasting an Authorization header into a Bruno, Insomnia, or Postman collection that does not have a Basic Auth helper, or whose helper produces malformed output for usernames containing @.
  • Building a curl one-liner against a CI artifact server, an internal Jenkins, or a self-hosted JFrog Artifactory: curl -H "Authorization: Basic ..." https://... avoids logging the password in shell history.
  • Constructing the auth header for a quick GitHub API probe with a personal access token (username = your handle, password = the PAT) before wiring up a proper client library.
  • Generating headers for staging environments behind shared HTTP basic gates, the kind that protect a Vercel preview deployment or a Netlify password-protected branch.
  • Producing the value for a webhook receiver that requires basic auth: services like Hookdeck, Svix, or a Cloudflare Worker proxy commonly accept the encoded token in their dashboard.
  • Debugging a 401 that mysteriously fails after a credential reset, where you need to confirm the encoded value byte-for-byte against what the server expects.

Common pitfalls and edge cases

  • Colons in the password break Basic Auth. RFC 7617 forbids the colon character in the userid (it is the separator), but the password may contain colons. Some legacy parsers split on the first colon and choke; if your password has one, switch to a token-based scheme.
  • Non-ASCII usernames or passwords need an explicit charset. Browsers default to UTF-8; older servers default to ISO-8859-1. RFC 7617 added the optional charset="UTF-8" challenge parameter to disambiguate. If the password contains accented characters and the server rejects, the encoding mismatch is the usual culprit.
  • Base64 is encoding, not encryption. Anyone with the header value can decode the credentials in one line of Python (base64.b64decode("...").decode()) or a single btoa reverse. Never send the header over plain HTTP.
  • Logging is the enemy. Most reverse proxies, load balancers, and access logs capture request headers. The Authorization header is one of the most commonly leaked secrets in S3 buckets and ELK clusters; scrub it explicitly.
  • Empty username is technically allowed but rejected by many servers as malformed. If a service accepts a token in the username field, leave the password blank rather than the other way round.
  • Passwords with newlines get truncated by some HTTP libraries before encoding. Strip \n and \r before pasting.

HTTP Basic Auth and RFC 7617

HTTP Basic was defined in RFC 1945 alongside HTTP/1.0, refined in RFC 2617 in 1999, and re-specified in RFC 7617 in 2015 to clarify charset handling and add the charset challenge parameter. The scheme is the simplest the standard library defines: a single round trip, no nonce, no replay protection, no client-side hashing. That simplicity is also why it survived: every HTTP client speaks it, every reverse proxy can validate it, and every framework supports it without a dependency. The tradeoff is that there is no built-in defense against credential capture, so the security of the channel rests entirely on TLS.

Alternatives and when they beat this tool

Inside curl, curl -u user:pass handles the encoding for you and never echoes the credentials back to stdout. Inside Node, Buffer.from("user:pass").toString("base64") is one line. Bearer token auth (Authorization: Bearer ...) is the modern replacement and is what every OAuth, JWT, or API-token flow uses; it avoids the round-trip-in-the-clear problem and supports scopes. Mutual TLS replaces both for service-to-service auth in zero-trust environments. Use this generator when you are debugging a Basic Auth integration interactively in a browser, do not want a half-built credential to land in your shell history, and do not want to paste the password into a remote service like base64encode.org or jwt.io to be regenerated.

Frequently Asked Questions

Does this send my username or password anywhere?

No. The header is generated locally in your browser from the two fields. The tool does not call an API or store the credentials.

Is Basic Auth encrypted?

No. Basic Auth uses Base64 encoding, which is reversible. The transport must be HTTPS if you use Basic Auth with real credentials.

Can I use an API token instead of a password?

Yes. Many services expect the username field plus an API token as the password field, or a token as the username with an empty password. Follow the service documentation.

More Security & Privacy