Skip to content
Allin

What Is Base64 Encoding?

Published 10/17/2025 · 2 min read · Developer tools

Daniel Okonkwo

Daniel OkonkwoFront-end developer and tech writer at Allin

Web performance · File formats

Checked against 2 sources

View profile
In short

Base64 encodes binary data as plain text using 64 safe characters (A–Z, a–z, 0–9, + and /). It isn't encryption — anyone can decode it — its job is to carry binary safely through text-only channels like email, JSON and data URIs. Base64 makes data about 33% larger, so use it to transport small assets, not to store or secure them.

Base64 turns binary data into safe text. Here's what it does, why it exists, why it isn't encryption, and the size cost it adds.

What it does

Base64 reads binary data three bytes at a time and rewrites those 24 bits as four characters from its 64-symbol alphabet. The result is ordinary text that looks like 'SGVsbG8=', where the trailing '=' is padding to keep the length a multiple of four. Decoding simply reverses the mapping to recover the exact original bytes.

Why it exists

Many systems were built to move text, not arbitrary bytes, and raw binary can be mangled by them — old email gateways, URLs, and formats like JSON that have no place for binary. Base64 dresses the binary as safe text so it survives the trip intact. It is what lets you embed an image directly in HTML or CSS as a data URI, or attach a file to an email.

It's not encryption

Base64 is fully reversible with no key, so it hides nothing — treat encoded text as if it were plain. People sometimes Base64 a password or token and imagine it is protected; it is not, and anyone can decode it in a second. To keep data secret, encrypt it; use Base64 only to transport, including transporting already-encrypted data through text channels.

The 33% size cost

Because Base64 spends four characters to represent every three bytes, the encoded form is roughly a third larger than the original. That is fine for small assets and transport, but wasteful for big files — a Base64 image inside your HTML bloats the page and can't be cached separately. For anything sizeable, link to the file instead of embedding it.

Base64 Encoder / DecoderEncode and decode Base64 online — free.Try the tool

Frequently asked questions

Is Base64 secure?
No. It is encoding, not encryption — it has no key and is trivially reversible, so it protects nothing.
Why does Base64 make data bigger?
It uses four text characters for every three bytes of input, adding roughly 33% overhead.
What are the '=' signs at the end?
They are padding, added so the encoded length is always a multiple of four characters.

Articles you may find interesting

All guides

Related tools

Sources

Spotted a mistake in this article?