Guide

What Is Base64 Encoding?

1 min readUpdated June 7, 2026

Base64 is a way of representing binary data — like an image, a file, or raw bytes — using only 64 plain text characters: A–Z, a–z, 0–9, and the symbols + and /. It exists because many systems were built to move text around reliably but choke on raw binary. Base64 lets you stuff binary data into a text-only channel without it getting corrupted.

If you have ever seen a long string that looks like SGVsbG8gd29ybGQ=, that is Base64. This guide explains what it is, how it works, where it is used, and one thing people constantly get wrong about it.

How Base64 works

Computers store everything as bytes — groups of 8 bits. Base64 takes three bytes (24 bits) at a time and splits them into four groups of 6 bits. Each 6-bit group is a number from 0 to 63, and each of those 64 values maps to one printable character. That is where the name comes from.

Because three bytes become four characters, Base64 output is always about 33% larger than the original data. When the input length is not a multiple of three, one or two '=' characters are added as padding so the length stays a multiple of four.

Where Base64 is used

Data URIs embed small images or fonts directly in HTML and CSS as Base64 strings, avoiding an extra network request. Email attachments are Base64-encoded so binary files survive mail servers that only handle text. APIs and JSON often Base64-encode binary fields because JSON has no native binary type. Basic HTTP authentication encodes the username and password as Base64.

Base64 is not encryption

This is the most common misconception. Base64 is encoding, not encryption. There is no key and no secret — anyone can decode a Base64 string instantly. It hides nothing. Never use Base64 to protect passwords, tokens, or sensitive data; use real encryption for that. Base64 only changes the representation of data, not its confidentiality.

Frequently asked questions

Is Base64 secure?+

No. Base64 is encoding, not encryption. Anyone can decode it instantly, so it provides no security. Use real encryption to protect data.

Why is Base64 data bigger than the original?+

Base64 turns every 3 bytes into 4 characters, so the encoded output is roughly 33% larger than the original binary data.

What does the = at the end mean?+

It is padding. When the input length is not a multiple of three, one or two '=' characters are added so the output length is a multiple of four.