Command Palette

Search for a command to run...

BA

Basic Auth Generator

Turn a username and password into an HTTP Basic Authentication header, base64 token, curl commands and URL form, and decode existing Basic auth tokens back.

What is a Basic Auth Generator?

A Basic Auth generator builds the credential that HTTP Basic Authentication requires: the base64 encoding of your username and password joined by a colon, prefixed with the word "Basic". The result is the value of the Authorization header a client sends to prove who it is. The scheme is defined in RFC 7617, "The Basic HTTP Authentication Scheme", and it is the simplest credential a server and client can agree on, which is why it is still everywhere in APIs, webhooks, private registries and internal tools.

The encoding is deliberately reversible. Basic auth is not encryption and offers no confidentiality on its own: base64 is a transport encoding, so anyone who can read the header can read the password back in one step. That is why this tool also decodes a token. Paste an Authorization: Basic value and it shows you the username and password it carries. The one rule that trips people up is that the username cannot contain a colon, because the first colon is the boundary between the two fields; the password may contain as many colons as it likes. This generator flags a colon in the username so a credential does not silently decode wrong.

Because the value is just base64 of "user:password", getting it right by hand is fiddly, and getting it wrong means a stream of 401 responses with no obvious cause. This tool produces the exact header line, the base64 token on its own, a ready-to-run curl command in both the -u and explicit-header forms, and the userinfo URL form (https://user:pass@host) for the cases where that still works. It encodes over UTF-8, so accented characters and non-Latin passwords produce the same bytes a compliant client would send, rather than being corrupted the way an ASCII-only encoder would corrupt them.

Everything happens in your browser. The username and password you type are never uploaded, which is the whole point when you are handling a real credential. Sending a live password to a server just to encode it would defeat the exercise. There is no signup and no logging, so it is safe to paste production credentials while you debug an integration.

Click Load sample to see the basic auth generator work on a password that contains a colon. The username admin and password s3cr3t:pass produce the Base64 token YWRtaW46czNjcjN0OnBhc3M=, so the Authorization header row reads Authorization: Basic YWRtaW46czNjcjN0OnBhc3M= and the curl (-u) row reads curl -u 'admin:s3cr3t:pass' https://example.com. The URL userinfo form percent-encodes the colon, giving https://admin:s3cr3t%[email protected]. Paste that header into Decode and you get admin and s3cr3t:pass back, because only the first colon splits the two fields. The same output works as a basic auth header generator for any client that takes a raw header.

How to use the Basic Auth Generator

  1. Enter the username and password

    Type the credential you want to encode. Optionally set the host so the generated curl and URL examples point at the right server.

  2. Copy the header or command

    Grab the Authorization header, the Base64 token on its own, the curl (-u) or curl (header) command, the fetch() header value, or the URL userinfo form, whichever your task needs. The fetch() row is the Basic <token> string to set as the Authorization header in your request options.

  3. Decode an existing token

    Switch to decode mode and paste a Basic auth header or token to recover the username and password it encodes.

  4. Check the warnings

    If the username contains a colon, the tool warns you, because the credential would decode with the wrong split at the receiving end.

Basic Auth Generator features

  • Header, token and curl output

    Produces the full Authorization: Basic line, curl -u and explicit-header commands, and the raw base64 token, each with its own Copy button.

  • Two-way encode and decode

    Encode a username and password into a token, or paste an existing Basic auth value to read the credential it carries back out.

  • UTF-8 correct

    Encodes the credential over UTF-8, so accented and non-Latin usernames and passwords produce the exact bytes an RFC 7617 client would send.

  • Colon validation

    Warns when the username contains a colon, the one input that makes a Basic auth credential decode incorrectly on the server.

Frequently Asked Questions

HTTP Basic Authentication is a scheme where a client sends a username and password with each request in the Authorization header. The value is the word "Basic" followed by the base64 encoding of "username:password". It is defined in RFC 7617 and is the simplest way for a server to check credentials.

Comments

0 comments

0/2000 characters

No comments yet. Be the first to share your thoughts!

basic auth generatorauthorization header generatorhttp basic authbasic authentication headerbase64 auth encodercurl basic authbasic auth decoderauthorization basicencode credentialsbasic auth header generatordecode basic auth token