Base64 is an encoding, not encryption

Published 17 October 2026

A Base64 string looks like noise, which is why it is so often mistaken for something secure. It is not. Base64 changes how bytes are written down; encryption changes who is able to read them. There is no key involved in Base64, so anyone who receives the string can turn it back into the original bytes in a line of code.

What Base64 actually does

It maps every 3 bytes of input onto 4 characters taken from a 64-symbol alphabet, which makes the output about a third longer. The point is not secrecy — it is making binary data survive channels that only accept text: email bodies, JSON strings, URLs, HTTP headers.

hello        ->  aGVsbG8=
alice:secret ->  YWxpY2U6c2VjcmV0
bytes FB FF  ->  +/8=

Decoding is a lookup in the other direction. Nothing is hidden, and nothing has to be guessed.

Where it is used, and why

The Basic auth example is the trap

Basic auth sends YWxpY2U6c2VjcmV0 for the username alice and password secret. That string is not encrypted. It has to be sent over TLS, because anyone who can read the header can decode the password in a second. The Base64 step exists to keep the colon-separated pair intact inside a header, not to protect it.

Base64URL is a different alphabet

Standard Base64 (RFC 4648 §4) uses + and /, which have meaning inside a URL. Base64URL (RFC 4648 §5) replaces them with - and _ and usually drops the = padding. The two encodings carry the same bytes but are not interchangeable as text: a decoder expecting one will reject or misread the other.

If you need confidentiality

The comparison

Base64 Encryption
Key required No Yes
Reversible by anyone who sees it Yes No
Provides confidentiality No Yes
Typical purpose Move bytes through text channels Keep data from being read
Wrong tool for Hiding secrets Encoding binary as text

Encode and decode with the Base64 tool. For hashes see the hash generator, and for credentials the password generator.