The Authorization: Basic header, correctly encoded
HTTP “Basic” authentication sends a username and a password in a header on every request. Building it is simple: join the username and the password with a colon, convert the whole thing to bytes, then encode those bytes in Base64. The example from RFC 7617, with the username “Aladdin” and the password “open sesame”, gives:
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
The generator does this calculation in your browser, from a username and a password you type or generate. The page is not allowed to make network requests: nothing you type leaves it.
Why UTF-8 matters
As long as the username and password contain only ASCII characters, every encoding gives the same result. As
soon as an accented letter or a symbol such as “£” or “€” appears, a choice has to be made, and RFC 7617
designates UTF-8, which the tool always applies. With the username “test” and the password
“123£”, the RFC's example gives dGVzdDoxMjPCow==. A Latin-1 encoding would produce different bytes,
and the server would reject the login without saying why.
The username cannot contain a colon, since that character separates it from the password; the password, on the other hand, can.
Decode an existing header
The tool also works the other way: paste an Authorization: Basic … header, or just the encoded
value, and it shows the username and password it contains. This is handy for checking what a client, a webhook
or a monitoring tool sends, or for understanding why authentication fails. Decoding happens in the page, just
like encoding.
The curl examples
The tool prepares two commands, ready to copy, that send the same request:
curl -H "Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==" https://api.example.com/
curl -u "Aladdin:open sesame" https://api.example.com/
With -u, curl builds the header itself from the characters your terminal passes to it. With
accented characters, the -H form, already encoded in UTF-8, avoids encoding surprises from one
terminal to another. Either way, the command usually stays in your shell history, along with the secret.
A Basic header is a password
Base64 makes the value unreadable at first glance, but it is not encryption: anyone can decode it in a second, just as this tool does. A Basic header copied into a ticket, a screenshot or a shared configuration file therefore gives away the username and password in plain text. For the same reason, Basic Auth is used only over HTTPS.
To hand these credentials to a colleague or a client, “Send with onlyU” sends the username and password. onlyU encrypts them in your browser and creates a link that opens only once, valid for 24 hours, then disappears. To understand what the header really contains, read our guide Basic Auth: what the header really contains.