Base64 is an encoding scheme that converts binary data (or any bytes) into a string made up of only 64 safe, printable ASCII characters: A-Z, a-z, 0-9, + and / (with = used for padding). It exists because many older text-based protocols and formats - email, URLs, JSON, XML - were never designed to safely carry arbitrary binary bytes. Base64 lets you embed that binary data anywhere plain text is expected.

A Simple Example

The text Hello, World! encodes to:

SGVsbG8sIFdvcmxkIQ==

Every 3 bytes of input become 4 Base64 characters, which is why encoded output is roughly 33% larger than the original data.

Where You'll See Base64

  • Data URIs - embedding a small image directly in HTML/CSS: data:image/png;base64,iVBORw0KG...
  • HTTP Basic Authentication - the Authorization: Basic <base64(user:pass)> header
  • Email attachments (MIME) - encoding binary files so they survive plain-text email transport
  • JWT tokens - the header and payload segments are Base64URL-encoded JSON
  • Storing binary in JSON - JSON has no native binary type, so binary fields are often Base64 strings

Base64 Is Not Encryption

This is the single most common mix-up: Base64 is encoding, not encryption. It provides zero confidentiality - anyone can decode it back to the original data instantly, with no key or password required. Never use Base64 alone to "hide" sensitive information; use real encryption if that's what you actually need.

Try It Yourself

Encode or decode any text to and from Base64 instantly, right in your browser.

Open Base64 Encoder/Decoder →