Ad Space (header)

Base64 Encoder / Decoder

Encode and decode Base64 strings with UTF-8 support and Data URI mode. 100% client-side.

About This Tool

## Understanding Base64 Encoding

Base64 encoding converts binary data into a text representation using 64 printable ASCII characters. The encoding was originally designed for email (MIME) but is now used extensively in web development.

### How It Works

Base64 takes every 3 bytes (24 bits) of input and splits them into 4 groups of 6 bits. Each 6-bit group maps to one of 64 characters. If the input length is not divisible by 3, padding characters (=) are added.

### Common Use Cases

- **Inline Images**: Embedding small images in CSS or HTML using Data URIs eliminates additional HTTP requests, improving initial page load for small assets. - **JWT Tokens**: JSON Web Tokens use Base64URL encoding (a URL-safe variant) for the header and payload sections. - **API Payloads**: Binary file uploads in JSON APIs are often Base64-encoded since JSON doesn't support raw binary. - **Email Attachments**: MIME uses Base64 to encode binary attachments in email messages.

Frequently Asked Questions

What is Base64 encoding?
Base64 is a binary-to-text encoding scheme that represents binary data using 64 ASCII characters (A-Z, a-z, 0-9, +, /). It is commonly used to embed binary data in text-based formats like JSON, XML, HTML, and email.
When should I use Base64?
Use Base64 when you need to embed binary data (images, files) in text formats, transmit binary data over text-only protocols, or encode data in URLs and cookies. Note that Base64 increases data size by approximately 33%.
What is a Data URI?
A Data URI (data: URL) allows you to embed small files directly in HTML or CSS using the format data:[mediatype][;base64],data. For example: data:image/png;base64,iVBOR... This eliminates extra HTTP requests but increases document size.
Is Base64 encryption?
No. Base64 is an encoding scheme, not encryption. It provides no security — anyone can decode Base64 data. Never use Base64 to protect sensitive information. Use proper encryption (AES, RSA) for security.