Build HTTP Basic auth headers with curl example
Credentials
Username and password are UTF-8 encoded and joined with : before Base64 encoding.
Authorization Header
Use as the value of the HTTP Authorization header.
Authorization: Basic YWRtaW46aHVudGVyMg==Encoded Token
Base64-encoded username:password (without the Basic prefix).
YWRtaW46aHVudGVyMg==curl Example
curl computes the header automatically from -u.
curl -u admin:hunter2 https://example.comAbout HTTP Basic Auth
How it works
The username and password are concatenated with a single colon (username:password), UTF-8 encoded, and Base64-encoded. The result is sent as Authorization: Basic <token>.
Security note
Base64 is encoding, not encryption — the credentials are trivially recoverable. Only send Basic Auth over HTTPS, and prefer stronger schemes (e.g. bearer tokens) where possible.