What is Base64?

Base64 is a way to represent binary data as plain ASCII text, using 64 safe characters. It exists so you can move bytes through systems that only handle text — like JSON, URLs, email, and HTML.

Encode or decode Base64 →

How it works

Base64 reads your data in 3-byte chunks (24 bits) and splits each chunk into four 6-bit groups. Each 6-bit group (a value from 0–63) maps to one character from the alphabet A–Z a–z 0–9 + /. So 3 bytes of input become 4 characters of output.

"Man"  →  01001101 01100001 01101110
       →  010011 010110 000101 101110
       →   19     22     5      46
       →   T      W      F      u
       →  "TWFu"

When the input length isn't a multiple of 3, the output is padded with = so the length is a multiple of 4. That's why Base64 strings often end in = or ==.

Why it's used

The size cost

Because 3 bytes become 4 characters, Base64 makes data about 33% larger. It's a transport encoding, not compression — don't Base64 things you don't need to.

URL-safe Base64

Standard Base64 uses + and /, which have special meaning in URLs. URL-safe Base64 replaces them with - and _ and usually drops the = padding. It's the variant used in JWTs and query strings.

Base64 is not encryption. It's trivially reversible — anyone can decode it. Never use it to "hide" passwords or secrets; it provides zero confidentiality.

Try it

The free Base64 encoder/decoder handles UTF-8 text (accents, emoji) and the URL-safe variant, and runs entirely in your browser — safe to paste sensitive values. To hash data one-way instead, use the SHA hash generator.

Open the Base64 tool →