Your monitoring script, your test harness or a quick curl call needs to log in to an API, and the documentation says the magic words: send your credentials with HTTP Basic authentication. Basic Auth is the oldest login scheme on the web, and at its heart sits one small job: take a username and a password, join them with a colon, encode the result as Base64, and send it in a header. This guide walks through that job with the free Base64 Text Encoder/Decoder on Ovatly, and it starts with the warning that matters most. The encoded value is not protected in any way. Anyone who sees it can decode it in seconds, which is why Basic Auth belongs only on HTTPS connections.
Contents
- Quick answer
- What Basic Auth actually sends
- The security warning, stated plainly
- How to build the header, step by step
- Worked example: an invented pair, encoded
- Limitations and honest warnings
- Common mistakes
- FAQs
- Conclusion
Quick answer
To build a Basic Auth header, join the username and password with a single colon, like demo-user:demo-pass, paste the joined text into the Base64 Text Encoder/Decoder, and press Encode to Base64. Take the output and send it as the header Authorization: Basic <output>. The encoding hides nothing: it is a transport format, not encryption, so only ever send it over HTTPS, where the connection itself protects the header in transit.
What Basic Auth actually sends
Basic Auth exists because HTTP headers carry text. A password can contain almost anything, including characters that would break a header or confuse a server, so the scheme first packs the credentials into a predictable shape: the username, a colon, then the password, all as one string. That string is then Base64 encoded, which represents it using only letters, digits and a few safe symbols, exactly the job the format was designed for in text-only channels like JSON, email and data URIs.
The server reverses the process. It decodes the Base64, splits the result at the colon, and checks the pair against its records. Nothing about the encoding is secret, and both sides know that. The encoding is plumbing, not a lock: it exists so the credentials survive the trip through headers intact, not so that nobody can read them.
The security warning, stated plainly
Say it without softening: a Base64 encoded credential is the credential, written in a different alphabet. Anyone who intercepts the header, reads it in a log file, or finds it in a screenshot can paste it into a decoder and read the username and password in plain text. There is no key, no password and no expiry on that decoding. It takes seconds.
That is why Basic Auth belongs only over HTTPS. On an encrypted connection, the header travels inside the protected channel and outsiders cannot read it. On plain HTTP, the same header is visible to every network hop between you and the server. Treat an encoded credential with exactly the same care as the raw password, because to anyone who finds it, they are the same thing.
How to build the header, step by step
- Write out the pair in a plain text editor first: username, one colon, password, with no spaces and no quotes. For this guide the invented example is
demo-user:demo-pass. - Open the Base64 Text Encoder/Decoder.
- Paste the joined text.
- Press Encode to Base64.
- Copy the output exactly, including any
=padding at the end. - Build the header: the word
Authorization, a colon, the wordBasic, one space, then the encoded text. - Send the request over HTTPS, and check the response. A 401 response usually means the pair itself was rejected, not the encoding.
Worked example: an invented pair, encoded
Encoding the invented pair demo-user:demo-pass gives:
ZGVtby11c2VyOmRlbW8tcGFzcw==
So the complete header line is:
Authorization: Basic ZGVtby11c2VyOmRlbW8tcGFzcw==
Note the two = signs at the end. Base64 works in groups of four characters, and the padding marks how many bytes were in the final partial group. Leave it in place: some decoders accept strings without padding, and this one does, but a server checking your header may expect the canonical padded form, and the padding costs you nothing.
You can verify the round trip yourself. Paste ZGVtby11c2VyOmRlbW8tcGFzcw== back into the same Base64 Text Encoder/Decoder, press Decode from Base64, and demo-user:demo-pass comes straight back. That is the whole security story in one gesture: if you can reverse it that easily, so can anyone else who gets hold of the header.
Limitations and honest warnings
- The encoding protects nothing. This is the limit that causes real damage when it is forgotten: encoded credentials are readable by anyone who sees them. Basic Auth over plain HTTP exposes the password itself, not a protected form of it.
- One colon is structural. The first colon separates the username from the password, so a username cannot contain a colon. Passwords can contain further colons, because the split happens at the first one.
- This tool encodes text, and that is all you need here. Credentials are text, so the text tool is the right one. Binary data belongs in a file tool, and images belong in the Base64 Image Encoder in the Image Tools category.
- Encoded output is about a third larger than the input. For a short credential pair that is a handful of characters, but it explains why encoded values in headers and payloads always look longer than what went in.
- Stored passwords deserve better than encoding. Encoding is for this one header in transit. Anywhere a password is stored, it belongs in a proper hash like bcrypt, never in Base64.
Common mistakes
- Sending Basic Auth over plain HTTP. The header is readable by every hop on the path. HTTPS is not optional with this scheme.
- Believing the encoding hides the password. It changes the alphabet, nothing more. If the header leaks, the password has leaked.
- Adding spaces or quotes around the pair.
demo-user: demo-passanddemo-user:demo-passencode to different strings, and only the second is the format the server expects. - Dropping the padding. Trimming the trailing
=signs makes some servers reject the header. Copy the output exactly as the tool gives it. - Encoding the username and password separately. The colon join happens before encoding, as one string. Two separate encodings glued together will not decode into a valid pair.
- Using real credentials in examples and screenshots. Encoded text in a ticket, a chat message or a doc is still the credential. Use invented pairs like the one in this guide whenever you demonstrate the format.
FAQs
What exactly do I encode for Basic Auth? One string: the username, a single colon, then the password, joined before encoding. Encode that whole string in one go, never the two halves separately.
Does Base64 encoding protect my password in the header? No. Base64 is an encoding, not encryption. Anyone who sees the header can decode it instantly and read the password, which is why Basic Auth must only travel over HTTPS.
Why does the encoded credential end with = signs?
Base64 works in groups of four characters. The = signs are padding that mark how many bytes were in the final partial group. Send them as part of the header.
Can a password contain a colon in Basic Auth? Yes. The server splits at the first colon, so everything after it counts as the password. A username cannot contain a colon, because that would move the split point.
The server still rejects my header. What should I check? Check the pair itself first: exact username, exact password, one colon, no stray spaces or quotes, and the padding left in place. Then confirm the request went over HTTPS to the right address.
Conclusion
Building a Basic Auth header is a two minute job: join the pair with a colon, encode it once with the Base64 Text Encoder/Decoder, and send it as Authorization: Basic ... over HTTPS. The mechanics are easy; the discipline is remembering that the encoded text is the password in another alphabet, and handling it accordingly. When a pasted string refuses to decode on the other side of a project, How to Fix Invalid Character Errors in Base64 Decoding works through the usual culprits. For more tools like these, see the Developer Tools guide archive.