Base64 Encode

Encode text to Base64.

Output appears here.

Some systems can only safely handle plain text, not raw binary data — email attachments, embedded images in stylesheets, tokens in URLs. Base64 solves that by re-encoding any data as plain ASCII text. This tool converts your input into that format.

A workaround born from email's text-only limitations

Base64 encoding traces its widespread adoption to the early internet email system, which was originally designed to carry only plain 7-bit ASCII text — a genuine limitation once people wanted to send images, documents or other binary files as attachments. The MIME (Multipurpose Internet Mail Extensions) standard, formalized in RFCs published in 1996, adopted Base64 specifically to solve this: by re-encoding binary data using only 64 safe, printable ASCII characters (A-Z, a-z, 0-9, plus two symbols), any file could be safely transmitted through text-only email infrastructure, then decoded back to its original binary form on the receiving end.

How the encoding works

Base64 takes your input data in chunks of 3 bytes (24 bits) at a time and re-splits those 24 bits into four 6-bit groups, since 6 bits can represent exactly 64 distinct values — mapping each group to one of the 64 characters in the Base64 alphabet. This is why Base64-encoded output is always about 33% larger than the original data: representing 8-bit bytes using only 6 bits' worth of information per output character necessarily takes more characters to encode the same amount of underlying data.

Where Base64 encoding is genuinely useful

  • Embedding images directly in CSS or HTML — small images can be Base64-encoded and embedded directly in a stylesheet or HTML document as a data URI, eliminating a separate HTTP request at the cost of a larger file size.
  • Encoding binary data in JSON or XML — since JSON and XML are text-based formats with no native way to represent raw binary data, Base64 is the standard way to embed binary content (like a file or image) within a text-based payload.
  • Basic authentication headers — HTTP Basic Authentication encodes the username and password combination using Base64 before including it in a request header (note: this is encoding, not encryption, and offers no security on its own without HTTPS).
  • Storing binary data in text-only systems — databases, configuration files or APIs that only accept text fields sometimes use Base64 to store binary content like small images or encrypted data blobs.

Frequently asked questions

Is Base64 encoding the same as encryption? No, and this is a critical distinction — Base64 is simply a reversible re-encoding scheme with no secret key involved, meaning anyone can decode Base64 data instantly with no special knowledge; it provides zero confidentiality or security on its own.

Why does Base64 output sometimes end with = signs? The equals sign is padding, added when the input data's length isn't an exact multiple of 3 bytes, ensuring the output always divides evenly into complete 4-character groups as required by the encoding scheme.

Why does encoded data get larger? Because Base64 trades data density for text-safety — representing every 3 bytes of original binary data as 4 text characters means the encoded output is consistently about 33% larger than the original, a deliberate and unavoidable tradeoff for guaranteed text-safe transmission.

Further reading