Base64 Encoder/Decoder

Encode and decode text, images, and files to Base64. Real-time conversion, URL-safe mode, drag-and-drop. All client-side.

Ctrl+Enter to convert
EncodeDecode
Text Input
0 chars0 B
Base64 Output
0 chars0 B

What is Base64 Encoding?

Base64 is a binary-to-text encoding scheme that represents binary data in an ASCII string format. It converts every 3 bytes of data into 4 ASCII characters using a set of 64 characters (A-Z, a-z, 0-9, +, /). This makes it safe to transmit binary data through text-based protocols like email (MIME), URLs, and JSON.

The encoded output is approximately 33% larger than the original data. URL-safe Base64 replaces + with - and / with _, and removes trailing = padding.

Common Use Cases for Base64

Data URIs in HTML/CSS

Embed small images, fonts, or other resources directly in HTML or CSS using data URIs. This reduces HTTP requests and can improve loading performance for small assets.

Email Attachments (MIME)

Email protocols like SMTP only support 7-bit ASCII text. Base64 encoding is used in MIME to encode binary attachments like images, PDFs, and documents.

API Data Transfer

Many REST APIs use Base64 to encode binary data within JSON payloads. This is common for file uploads, image processing APIs, and authentication tokens like JWT.

Storing Binary Data

When you need to store binary data in text-only systems (XML, JSON, databases), Base64 provides reliable encoding. Config files and secrets managers often store certificates this way.

Frequently Asked Questions

Is this tool secure? Is my data sent to a server?

All encoding and decoding happens entirely in your browser using native JavaScript APIs (btoa, atob, TextEncoder, FileReader). No data is ever sent to any server. Your text, images, and files never leave your device.

Is Base64 encryption?

No. Base64 is an encoding scheme, not encryption. It does not provide any security — anyone can decode a Base64 string. Never use Base64 to protect sensitive data.

How much larger is Base64 compared to the original data?

Base64 encoding increases the data size by approximately 33%. Every 3 bytes of input becomes 4 bytes of Base64 output. For example, a 1 MB file will produce roughly 1.33 MB of Base64 text.

What is URL-safe Base64?

Standard Base64 uses + and / characters which have special meanings in URLs. URL-safe Base64 (RFC 4648) replaces + with -, / with _, and removes the = padding. This makes the encoded string safe to use in URLs, query parameters, and filenames.

Can I encode images to Base64 for use in CSS?

Yes. Use the Image tab to convert images to Base64 data URIs. The tool generates ready-to-use CSS (background-image) and HTML (img src) code snippets. This technique is useful for small icons and images to reduce HTTP requests, but not recommended for large images due to the 33% size increase.