What is Base64 Encoding?
A practical primer on Base64 — what it is, what it is not, and when to use it.
You've probably seen a string like SGVsbG8sIHdvcmxkIQ== in an HTTP header, a
data URI, or a JWT and wondered what it is. That's Base64 — and despite
appearances, it's one of the simplest encodings in computing.
It's encoding, not encryption
Base64 is not secret. It's a deterministic way to represent binary data as printable ASCII characters. Anyone can decode it without a key. If you need to keep something private, encrypt it first, then Base64-encode the ciphertext if you need to ship it through a text-only channel.
Decode any Base64 string instantly — no installation, no upload.
Why does it exist?
Many protocols and formats — early email (MIME), HTTP headers, JSON, XML — can
only safely carry printable ASCII characters. Sending raw binary through those
channels risks special characters being interpreted as control codes. Base64
solves this by packing every 3 bytes of binary into 4 ASCII characters drawn
from a 64-character alphabet (A-Z, a-z, 0-9, +, /).
The size cost
Base64 inflates the data by about 33%: 3 bytes become 4 ASCII bytes, plus
optional padding (=). That's why you don't see Base64-encoded video streams
— the bandwidth cost is real. For small payloads (a thumbnail in a data URI,
an API key in a header), the convenience easily outweighs the size cost.
Base64 vs Base64URL
There are two flavors. Standard Base64 uses + and /, which have special
meaning in URLs. Base64URL replaces them with - and _ so the result is
URL-safe. JWTs use Base64URL; the JWT Decoder handles
the conversion automatically.
When you might use it
- Embedding a small image directly in HTML/CSS via a
data:URL. - Sending binary data in a JSON payload that doesn't support binary natively.
- Basic-auth headers (
Authorization: Basic <base64-encoded user:pass>). - The header and payload portions of a JWT.
That's the whole story. Base64 is a translation layer between binary and text — nothing more, nothing less. Need to encode or decode? The Base64 Encoder handles UTF-8, emoji, and all the edge cases for you.