Reference Guide

What Is Base64?

Understand how Base64 encoding works, why it exists, where it is used, and common mistakes developers make.

6 min read Updated Jun 2026

Quick Answer

Base64 is a binary-to-text encoding format. It converts data into text characters so that binary information can be safely transmitted through systems designed primarily for text.

If you just need to encode or decode something right now, you can use the tool directly.

Try the Base64 Encoder & Decoder →

What Is Base64?

Imagine you have a photograph saved on your computer. That photo is made up of raw binary data — millions of 0s and 1s. Now imagine you need to send that photo inside a text message or an email that only understands plain text characters. You have a problem.

Base64 solves this. It takes any kind of binary data and converts it into a safe string of 64 characters: the 26 uppercase letters (A–Z), the 26 lowercase letters (a–z), the digits 0–9, and the characters + and /. The result looks like random text, but it is actually your original data in a different form.

The name "Base64" simply means the encoding uses a 64-character alphabet — the same way "base 10" means you count with 10 digits (0–9), and "base 2" means you count with 2 digits (0 and 1).

Why Was It Created?

In the early days of the internet, email systems were built strictly for plain text. The standard that defined email — called SMTP — was designed to carry 7-bit ASCII characters only. That covers the English alphabet, numbers, and basic punctuation.

The problem: photos, documents, spreadsheets, and other binary files contain byte values outside that range. When these files passed through old email servers, the servers would sometimes corrupt the data by stripping or mangling bytes they did not recognize.

Base64 was introduced as part of the MIME standard (Multipurpose Internet Mail Extensions) in the early 1990s to solve this problem. By converting binary data into pure ASCII text before sending it, the data could pass through any text-only system without corruption.

Today, Base64 is used far beyond email — it appears in APIs, web tokens, HTML data URIs, and many other contexts where binary data needs to travel through text-based channels.

How It Works

Base64 processes data in chunks of 3 bytes at a time. Each chunk of 3 bytes (24 bits) is split into 4 groups of 6 bits each. Each 6-bit group becomes one character from the Base64 alphabet. This is why the output is always longer than the input — 3 bytes become 4 characters.

Here is a simple example:

Hello SGVsbG8= Hello

The trailing = is padding. If the input length is not a multiple of 3 bytes, padding characters fill out the final group so the decoder knows exactly where the data ends. You may see one = or two ==, depending on how many bytes are left over.

Decoding is the exact reverse: each group of 4 Base64 characters is converted back to 3 bytes of original data. The result is byte-for-byte identical to the original input.

Real-World Uses

Base64 appears constantly in modern software:

  • JWT tokens — JSON Web Tokens use Base64URL encoding (a URL-safe variant) to carry the header and payload sections. You can paste a JWT into a decoder to inspect its contents.
  • Email attachments — Email clients encode attachments as Base64 before sending them through SMTP servers, then decode them on the receiving end.
  • Images in HTML and CSS — Developers embed small images directly in web pages as Base64 data URIs (data:image/png;base64,...) to eliminate extra HTTP requests.
  • API responses and JSON payloads — When an API needs to return binary data (like a generated image or a PDF) inside a JSON response, it encodes the binary as a Base64 string.
  • Authentication credentials — HTTP Basic Authentication sends usernames and passwords encoded as Base64 in the Authorization header.

Common Mistakes

These misunderstandings come up frequently:

History

Base64 was formally defined in RFC 1341 in 1992 as part of the MIME specification, which extended internet email to support attachments, multiple content types, and character sets beyond ASCII. Before MIME, email was strictly plain text and file sharing required separate protocols like FTP.

The specific 64-character alphabet was chosen because these characters are universally supported across all ASCII-compatible systems and do not carry special meaning in most text-based protocols. The encoding has remained essentially unchanged for over 30 years and is now defined in RFC 4648 (2006), which also specifies the Base64URL and Base32 variants.

Common Questions

What is Base64?

Base64 is a binary-to-text encoding scheme that converts binary data into a sequence of 64 printable ASCII characters. It was designed to safely represent arbitrary byte data as text so it can pass through systems that only handle text — such as email servers or HTTP headers.

How do I encode text to Base64?

Paste or type your text into the input field, then select "Encode → Base64" from the mode selector. The encoded output appears instantly in the right panel. You can copy it with the Copy button.

How do I decode Base64 back to text?

Paste your Base64 string into the input field and select "Decode ← Base64" from the mode selector. The decoded plain text appears in the output panel. If the input is not valid Base64, the tool will show an error message.

Is Base64 a form of encryption?

No. Base64 is encoding, not encryption. Encryption uses a secret key to scramble data so that only authorized parties can read it. Base64 simply changes how data is represented — anyone can decode it instantly without any key. Never use Base64 to protect sensitive information.

View all questions →