03 / API & Auth / basic-auth-header
Basic Auth Header Generator
Generate HTTP Basic Authentication headers.
How to use
- 01Enter the username for the API or service you are calling.
- 02Enter the matching password; use the eye button to show or hide it. Both fields are required.
- 03Press Generate Header (or Ctrl/Cmd + Enter) to Base64-encode username:password.
- 04Press Copy Header for the full Authorization line, or Copy Base64 for just the encoded value.
What is this tool?
HTTP Basic Authentication sends a username and password as a Base64-encoded string in the Authorization header. This generator joins the two with a colon, encodes the result as UTF-8 Base64 and formats it as Authorization: Basic <value>. It runs entirely in your browser, so your credentials never leave your machine.
How the Basic Authorization header is built
RFC 7617 defines the format: join the username and password with a single colon, Base64-encode the bytes, and prefix the result with the word Basic. For user and pass, user:pass encodes to dXNlcjpwYXNz, so the header is Authorization: Basic dXNlcjpwYXNz. admin:s3cret becomes YWRtaW46czNjcmV0.
The tool encodes text as UTF-8 before Base64, so non-ASCII credentials work: josé:pässword becomes am9zw6k6cMOkc3N3b3Jk. Because the colon is the separator, a username cannot contain one, although a password can. If you use curl, -u user:pass produces the same header for you.
Basic auth vs Bearer tokens
Basic auth sends long-lived credentials with every request. Anyone who captures the header can decode it with any Base64 decoder and reuse the password until it is changed, so it must only travel over HTTPS. It remains common for internal services, CI webhooks, package registries and API keys that a provider issues as a username and secret pair.
Bearer tokens, such as OAuth 2.0 access tokens and JWTs, are issued after a login step, usually expire within minutes or hours, and can carry scopes. A leaked Bearer token is still dangerous, but it limits exposure in time and never reveals the underlying password. When an API supports both, prefer tokens for anything user-facing.
Using the Basic auth header in curl, Postman and fetch
In curl, paste the copied header after -H: curl -H 'Authorization: Basic dXNlcjpwYXNz' https://api.example.com. In Postman or Insomnia, add it on the Headers tab, or use their Basic Auth option, which builds the same value. In JavaScript, set headers: { Authorization: 'Basic dXNlcjpwYXNz' } on a fetch() call.
If a server still answers 401, check for a trailing space or newline in the username or password, confirm the account is not locked, and look at the WWW-Authenticate response header, which names the scheme the server actually expects.
Common use cases
- Testing endpoints protected with Basic Auth in Postman or cURL
- Configuring CI jobs that call internal APIs
- Debugging 401 responses from legacy services
- Building the header for a webhook or package registry that expects Basic credentials
- Documenting example requests for a team wiki
FAQ
Is Basic Auth secure?
Base64 is encoding, not encryption. Basic Auth is only safe over HTTPS, where the connection itself is encrypted.
Are my credentials sent anywhere?
No. Encoding happens locally in your browser.
What is the Basic auth header format?
Authorization: Basic base64(username:password). For example, user:pass becomes Authorization: Basic dXNlcjpwYXNz.
Can I decode a Basic auth header back to the password?
Yes, any Base64 decoder reverses it, which is why HTTPS matters.
Does it support special or non-English characters?
Yes. Credentials are encoded as UTF-8 before Base64, which is what most modern servers expect.
Can I generate a header with an empty password?
No. The tool asks for both a username and a password before it generates the header.