How Base64 Works in HTTP Basic Auth
HTTP Basic Auth sends credentials as a Base64-encoded string. The important detail: Base64 is reversible encoding, not encryption.
The format
Basic Auth starts with this plain text format:
username:password
That text is encoded with Base64 and then sent in the HTTP Authorization header:
Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=
Step-by-step example
- Combine the username and password with a colon:
demo:secret. - Base64 encode that exact string.
- Prefix the encoded value with
Basic. - Send it as the
Authorizationheader.
Security warning
Base64 does not hide a secret. Anyone who receives the header can decode it. Basic Auth should only be used over HTTPS, and real credentials should not be pasted into tools unless your own security policy allows it.
Use the tool
Open the Base64 Encode and Decode Online tool to encode or decode UTF-8 text locally in your browser.