What Is Base64 Encoding?

Base64 is a binary-to-text encoding scheme that converts binary data — images, files, or any arbitrary bytes — into a string of ASCII characters. The name comes from the 64 characters used in the encoding alphabet: the 26 uppercase letters A-Z, 26 lowercase letters a-z, the digits 0-9, and the symbols + and /. A 65th character = is used for padding. Base64 encoding increases the size of data by approximately 33% — every 3 bytes of binary data becomes 4 characters of Base64 text.

Why Base64 Encoding Exists

Many data transmission protocols were originally designed to handle text only. Early email systems, HTTP headers, and XML data formats cannot safely transmit raw binary data because binary bytes include control characters that have special meanings in these protocols. Base64 provides a way to represent any binary data using only printable ASCII characters that are safe to include in text-based formats. This is why email attachments, embedded images in HTML, and data URIs all use Base64 encoding.

Common Uses of Base64 in Web Development

Data URIs use Base64 to embed images directly in HTML or CSS without a separate HTTP request. An img tag with a Base64 encoded image looks like: src="data:image/png;base64,iVBORw0KGgo...". This eliminates an additional network request for small icons and logos, which can improve page load performance. JWT (JSON Web Tokens) use Base64URL encoding (a variant that replaces + with - and / with _ for URL safety) to encode the header and payload sections of authentication tokens. API responses sometimes include binary file content encoded as Base64 strings, particularly for document generation and image processing APIs.

Base64 in Email Attachments

Email attachments are transmitted using MIME (Multipurpose Internet Mail Extensions) encoding, which uses Base64 to convert binary files into text safe for email transport. When you attach a PDF or image to an email, your email client Base64 encodes the file and embeds it in the email body. The recipient's email client decodes it back to the original file. This encoding and decoding happens transparently — you never see the Base64 string directly.

How to Use Our Free Base64 Encoder/Decoder

Our free Base64 encoder and decoder at cookiescursor.com handles both text and image encoding. In Encode mode, paste any text or upload an image file to get the Base64 string. In Decode mode, paste a Base64 string to recover the original text, or paste an image data URI to see the image preview. All encoding and decoding happens in your browser — your data is never sent to our servers. No signup required.

Frequently Asked Questions

Is Base64 the same as encryption?
No. Base64 is encoding, not encryption. It is completely reversible by anyone who has the Base64 string — no key or password is required. Base64 should never be used to secure sensitive data.

Why does Base64 end with == sometimes?
The == padding characters appear when the input data length is not a multiple of 3 bytes. One = indicates one byte of padding was added, == indicates two bytes.

What is Base64URL?
Base64URL is a URL-safe variant that replaces + with - and / with _ to avoid characters that have special meaning in URLs. It is used in JWTs and URL-safe data transmission.

How much larger is Base64 encoded data?
Base64 encoding increases data size by approximately 33%. A 100KB image becomes approximately 133KB when Base64 encoded.

Can I use Base64 to embed fonts in CSS?
Yes. Embedding fonts as Base64 data URIs in CSS eliminates the font file HTTP request. However, for large font files this significantly increases CSS file size and may hurt page performance.

What is the maximum size I can encode?
Our tool runs in your browser and is limited by available memory. For practical purposes, files up to a few megabytes encode without issues.

Encode or Decode Base64 Now

Use our free Base64 encoder and decoder for instant conversion of text and images. No signup required.