Web & HTTP

Basic Auth Generator: Create HTTP Basic Authentication Headers

Generate Base64-encoded HTTP Basic Authentication header values from a username and password. Copy the Authorization header value instantly.

Published January 15, 2025Updated June 1, 20254 min read

Try the free online tool

Runs entirely in your browser — no signup, no uploads.

Open Tool

HTTP Basic Authentication is one of the oldest and simplest authentication mechanisms in the HTTP protocol. It works by encoding a username and password as a Base64 string and sending it in the `Authorization` request header. While it's not the most secure method for user-facing applications, Basic Auth is widely used for API authentication, internal tools, CI/CD webhooks, and server-to-server communication — especially over HTTPS.

Constructing a Basic Auth header manually means concatenating the username and password with a colon (`username:password`), then Base64-encoding the result, and finally prepending `Basic ` to form the header value. It's a simple process but just awkward enough to slow you down when testing an API or configuring a client.

This tool does it for you instantly. Enter a username and password, and get the complete `Authorization` header value ready to paste into cURL, Postman, code, or a configuration file.

What Is HTTP Basic Authentication?

HTTP Basic Authentication is defined in RFC 7617. When a client wants to authenticate, it sends an `Authorization` header with the value `Basic <credentials>`, where `<credentials>` is the Base64 encoding of the string `username:password`.

For example, for username `admin` and password `secret`, the combined string is `admin:secret`. Base64-encoding this gives `YWRtaW46c2VjcmV0`. The full header value is `Basic YWRtaW46c2VjcmV0`.

It's important to understand that Base64 encoding is not encryption — it is trivially reversible. The credentials are essentially sent in plain text. This means Basic Auth must always be used over HTTPS to prevent the credentials from being intercepted in transit. When used over plain HTTP, anyone on the network can read the credentials.

How to Use This Tool

Generate a Basic Auth header value in seconds.

  1. 1

    Enter your username

    Type the username (or API key) into the Username field. This is the first part of the credential string.

  2. 2

    Enter your password

    Type the password (or API secret/token) into the Password field. The tool shows the field as masked by default for privacy.

  3. 3

    Click Generate

    The tool combines the values as `username:password`, Base64-encodes the combined string, and prepends `Basic ` to form the complete header value.

  4. 4

    Copy the header value

    Click the copy button to copy the full `Authorization: Basic <value>` header, or just the Base64 token portion, for use in your request.

  5. 5

    Use in cURL, Postman, or code

    Paste the header value into your HTTP client. In cURL, use the `-H 'Authorization: Basic <value>'` flag, or the shorthand `--user username:password` which cURL encodes automatically.

Common Use Cases

Basic Auth is used in many situations where simple credential-based authentication is needed.

  • Authenticating to REST APIs that use Basic Auth — many payment gateways, CRMs, and internal APIs use API key + secret as Basic Auth credentials.
  • Configuring CI/CD pipeline calls to protected endpoints — generating the token once and storing it as a secret environment variable.
  • Testing authentication in Postman or Insomnia — quickly generating the token to paste into the Authorization tab.
  • Setting up HTTP Basic Auth on nginx or Apache — generating the encoded credentials for use in server configuration or `.htpasswd` files.
  • Writing integration test fixtures — encoding known test credentials to use in automated test request headers.

Tips and Best Practices

Follow these security guidelines when using HTTP Basic Authentication.

  • Always use HTTPS — Basic Auth credentials are only Base64-encoded, not encrypted. Over plain HTTP, they can be intercepted trivially.
  • Never hardcode credentials — store the generated token in environment variables or a secrets manager, not in your source code.
  • Use API keys instead of real user passwords when possible — if the key is compromised, it can be rotated without affecting the user's account.
  • Rotate credentials regularly — and immediately rotate them if you suspect they may have been exposed (e.g., accidentally committed to a repository).
  • Consider OAuth or token-based auth for user-facing flows — Basic Auth is most appropriate for machine-to-machine server communication.

Frequently Asked Questions

Is Basic Auth the same as sending a password in plain text?

Functionally, yes — Base64 encoding is not encryption and is trivially reversible. Basic Auth credentials sent over plain HTTP are as exposed as plain text. Over HTTPS, the credentials are protected by TLS, making Basic Auth over HTTPS reasonably secure.

What is the format of a Basic Auth header?

The header name is `Authorization` and the value follows the format `Basic <credentials>`, where `<credentials>` is the Base64 encoding of the string `username:password`. The colon is the separator between username and password.

Can the username or password contain a colon?

The username must not contain a colon (`:`) because the colon is used as the separator in the `username:password` string. Passwords may contain colons — only the first colon in the decoded string is treated as the separator.

How do I decode a Basic Auth token?

Take the Base64 string (the part after `Basic `), decode it from Base64, and the result is the `username:password` string. Any Base64 decoder can do this, which is why HTTPS is mandatory for Basic Auth security.

Can I use Basic Auth with API keys instead of a username and password?

Yes. Many APIs accept an API key as the username and either leave the password blank or use a fixed value like `x`. For example, Stripe uses `Authorization: Basic <base64(api_key:)>`. Check your API provider's documentation for the expected format.

What should I do if my Basic Auth credentials are exposed?

Immediately rotate the compromised credentials — generate a new password or API key and revoke the old one. If real user credentials were exposed, consider notifying affected users and auditing access logs for unauthorized use.

authenticationbasic authbase64httpsecurity

Ready to use this tool?

Free, instant, no account required. Runs entirely in your browser.

Open Tool

More Web & HTTP Guides