Encoding · Guide

What Is Base64 Encoding?

What is Base64 encoding?

SHORT ANSWER

Base64 converts every three bytes of input into four printable characters chosen from a 64-character alphabet. It exists so binary data can travel through systems that only handle text, and it is encoding, not encryption, since anyone can decode it back.

Why Base64 exists

Email, URLs, JSON, and many APIs were built for text. When you need to move a PNG, a certificate, or any binary payload through them, the bytes must become printable characters first. Base64 is the standard mapping: three bytes in, four characters out.

How the mapping works

The encoder reads the input in groups of three bytes and splits them into four 6-bit chunks, then maps each chunk to one of 64 characters: A to Z, a to z, 0 to 9, plus two more depending on the alphabet. When the input length is not a multiple of three, the output is padded with = signs.

Why the output is bigger

Every three bytes become four characters, so encoded text is about 33% larger. We encoded cat.png 2,412,339 bytes to 3,216,452 chars (33.3%, ls -l + wc -c on the file). Standard alphabet uses + and / which break in URLs (+ becomes space via application/x-www-form-urlencoded plusSpace, / splits path), so URL-safe swaps them for - and _. Length %4 ==1 is always illegal (our decoder throws Incomplete base64 group at engine.ts:84), ==2 or 3 is recoverable via tailBytes, and === is never valid. The meter on the tool shows the ratio live.

Encode versus decode

Encoding converts bytes to the safe alphabet; decoding reverses it. The same tool does both. When you decode, it reads the first bytes of the result and names common formats like PNG, JPEG, PDF, or ZIP, or marks it as JSON or plain text, so you know what you recovered.

Standard versus URL-safe

The standard alphabet includes + and /, which have meaning inside URLs. URL-safe Base64 swaps them for - and _ and drops the = padding, producing strings that can sit in a query parameter without escaping headaches.

Is Base64 encryption?

No. Encoding has no key and is trivially reversible, so it hides nothing. Base64 is for transport and storage of binary data, not secrecy. Anything you encode in Base64 can be decoded by anyone, which is why a local encoder that never uploads your data is the right way to work with sensitive payloads.

TRY IT LOCALLY

Try it in your browser with our Base64 Encode / Decode. No upload, no server.

Open Base64 Encode / Decode →

FAQ

Why does the encoded output get bigger?

Base64 represents every three bytes of input as four printable characters, so the result is always at least about 33% larger than the raw bytes.

What is URL-safe Base64?

It replaces the + and / characters with - and _ and drops the = padding, so the string is safe inside URLs and query strings.

Is Base64 encryption?

No. It is an encoding with no key and no secrecy. Anyone can decode Base64 back to the original bytes.

Can I encode a file locally?

Yes. Drop a file and the tool encodes it in your browser, in a background worker for large inputs. Nothing is uploaded.