All articles
DeveloperEncodingJul 22, 2026 · 4 min read

What Is Base64 Encoding? A Simple Guide with Examples

Base64 is a way to represent binary data — like an image or a file — using only 64 plain text characters (A–Z, a–z, 0–9, +, and /). It lets you move binary data safely through systems that only expect text, such as JSON, URLs, or email.

Why does Base64 exist?

Many older protocols and text formats can corrupt raw binary data. Base64 sidesteps this by converting bytes into a safe, printable subset of characters. The trade-off is size: Base64 output is about 33% larger than the original, because it encodes 3 bytes as 4 characters.

How it works (briefly)

Base64 takes 3 bytes (24 bits) at a time and splits them into four 6-bit groups. Each 6-bit group (0–63) maps to one character in the Base64 alphabet. When the input isn't a multiple of 3 bytes, = padding is added at the end.

Try it

Encode or decode text with our Base64 encoder / decoder — it has full Unicode (UTF-8) support, so emoji and non-English text convert correctly. To embed an image directly in HTML or CSS, use the image to Base64 tool to get a data URI.

Common uses

  • Embedding small images or fonts inline as data URIs.
  • Encoding binary attachments in email (MIME).
  • Storing binary blobs in JSON or a database text field.
  • The header and payload of a JWT are Base64url-encoded.

Base64 is not encryption

This is the most important thing to understand: Base64 is encoding, not encryption. Anyone can decode it instantly — it provides zero security. Never use Base64 to "hide" passwords, tokens, or secrets. If you need secrecy, use real encryption; if you need to verify integrity, use a hash.

Base64 vs. URL encoding

They solve different problems. Base64 makes binary data text-safe. URL encoding (see our URL encoder) escapes special charactersso text is safe inside a URL. There's also a "Base64url" variant that swaps + and / for URL-safe characters.