Jul 20, 2026
5 min read
Computers store everything as bytes, but many systems were designed to carry only text: email protocols, JSON documents, URLs, XML files. Try to push raw binary data — an image, an encryption key — through a text-only channel and bytes get mangled, stripped, or misinterpreted.
Base64 is the bridge. It re-writes any binary data using only 64 safe, printable characters — A–Z, a–z, 0–9, +, and / (with = as padding) — so binary can travel anywhere text can.
That is the entire job. Base64 is a transport format, not a security measure — a distinction we will return to, because it is the most common exam trap and real-world mistake.
The mechanism is a simple regrouping of bits:
= so it always aligns to 4 characters.Worked example — encoding the word Hi:
H i
01001000 01101001 ← 2 bytes = 16 bits
010010 000110 1001(00) ← regroup into 6-bit chunks, pad bits
18 6 36
S G k = ← 64-char table + '=' padding
Hi → SGk=. Three bytes of input always become four characters of output, which is why Base64 output is roughly 33% larger than the input. That overhead is the price of text-safety.
You can verify this right now: type Hi into the free Base64 Encoder/Decoder and watch it produce SGk= — then decode it back.
Base64 shows up constantly once you know to look for it:
<img src="data:image/png;base64,iVBORw0KGgo...">. Saves an HTTP request for tiny icons.Authorization: Basic dXNlcjpwYXNz is just user:pass in Base64.-----BEGIN CERTIFICATE----- markers are Base64.This deserves its own section because the mistake is so common it appears in security incident reports every year.
Base64 has no key and no secret. Anyone can decode it instantly — including you, with one click in the Base64 tool. The Basic Auth example above illustrates it: dXNlcjpwYXNz looks obscured, but it is user:pass for anyone who spends two seconds decoding.
| Base64 encoding | Encryption | |
|---|---|---|
| Purpose | Make binary text-safe | Keep data secret |
| Reversible by anyone? | Yes, instantly | Only with the key |
| Protects sensitive data? | No | Yes |
Rules that follow: never store passwords in Base64 and call them protected; never put secrets in a JWT payload thinking they are hidden; treat Base64'd credentials in a URL or log file as plainly exposed. If an assignment asks "does Base64 provide confidentiality?" — the answer is a firm no, and now you can explain why.
One practical variant matters: standard Base64 uses + and /, but both characters have special meanings in URLs. Base64url swaps them for - and _ (and usually drops padding), making the output safe inside URLs and filenames. JWTs use Base64url — which is why pasting a JWT segment into a strict standard-Base64 decoder sometimes fails.
Use Base64 when binary data must pass through a text-only channel: embedding a small image in CSS, sending a file inside a JSON API request, storing binary in an environment variable.
Avoid Base64 when the channel handles binary natively. Serving images as separate files beats data URIs for anything but tiny icons (Base64 inflates size by a third and cannot be cached independently). And never use it for security — that is a category error, not a weak choice.
The fastest way to internalize Base64 is to play with it: encode your name, decode a JWT segment, round-trip some UTF-8 emoji. The free Base64 Encoder/Decoder handles all of it in your browser — nothing you type is sent to any server.
And if a networking, web development, or security assignment has you tangled in encodings, the programming help service at EduSupport connects you with developers who work with this daily — from quick concept explanations to full project support.
Our expert team is available 24/7 for assignments, projects, and exam prep.