01 Aa == B64 +/=

Base64 Encoder / Decoder

Encode text and files to Base64 or decode Base64 strings instantly. Supports standard, URL-safe, and MIME encoding. Generate data URIs, preview images, drag & drop files. Free, real-time, 100% browser-based.

Real-time
Encode mode: Paste text or upload a file to convert it into a Base64 string. Output is safe for JSON, HTML, URLs, and email.

Text / File Input

0 chars
Drop your file here Any file type supported

Base64 Output

0 B
Original 0 B
Encoded 0 B
Size Ratio 0%
Encoding Standard
Lines 0
Characters 0

What is Base64 Encoding?

Base64 is a binary-to-text encoding scheme that converts any data — text, images, PDFs, or binary files — into a string of printable ASCII characters. It uses 64 characters (A-Z, a-z, 0-9, +, /) plus = for padding.

Every 3 bytes of input become 4 Base64 characters, making the output approximately 33% larger than the original. This trade-off allows binary data to travel safely through text-only channels like JSON, XML, email (MIME), and data URIs in HTML/CSS.

Standard (RFC 4648) Uses A-Z, a-z, 0-9, +, / with = padding
URL-safe Replaces +/ with -_ for URLs and filenames
MIME Wraps at 76 characters for email transmission
Data URI data:mime;base64,... for embedding in HTML/CSS

Common Use Cases

Embedding images in HTML/CSS — Convert small icons and logos to data URIs to eliminate extra HTTP requests and improve page load speed.

API data transmission — Send binary files (PDFs, images) through JSON APIs that only support text, or encode authentication tokens for HTTP headers.

Email attachments — MIME encoding is the standard for email attachments. Base64 ensures binary files survive transport through email servers.

Storing binary data in text formats — Save images or certificates in XML, JSON, or database text fields that don't support raw binary.

Advertisement
Ad

How to Use — 3 Simple Steps

01

Enter Your Input

Type or paste text to encode, or paste a Base64 string to decode. You can also upload or drag & drop any file — images, PDFs, documents — and the tool will encode it automatically.

02

Choose Mode & Options

Toggle between Encode and Decode. Select your encoding type: Standard, URL-safe, or MIME. Enable data URI prefix or line wrapping as needed.

03

Copy or Download

Results appear instantly as you type. Copy the output to clipboard, or download it as a file. For images, a preview is shown automatically.

Encoding Reference

InputStandard Base64URL-safeNotes
HelloSGVsbG8=SGVsbG8Padding removed in URL-safe
AQQ==QQ2 padding chars for 1-byte input
ABQUI=QUI1 padding char for 2-byte input
ABCQUJDQUJDNo padding for 3-byte input
Hello World!SGVsbG8gV29ybGQhSGVsbG8gV29ybGQhSame when no +/ needed
(binary with +/)a+b/c==a-b_c+/ become -_ in URL-safe

Pro Tips

Small Images as Data URIs

For icons under 10 KB, data URIs eliminate an HTTP request. For larger images, use regular files — the 33% size increase outweighs the benefit.

URL-safe for Tokens

JWT tokens and API keys use URL-safe Base64 so they can appear in URLs without percent-encoding. Select “URL-safe” when working with tokens.

UTF-8 Support

This tool properly handles UTF-8 text (emoji, CJK characters, accents). Standard btoa() fails on non-ASCII — we encode UTF-8 first.

Decode with Whitespace

Pasting Base64 with line breaks? Enable “Strip whitespace on decode” to clean up before decoding. This handles MIME-formatted input automatically.

Advertisement
Ad

Frequently Asked Questions

What is Base64 encoding?

Base64 is a binary-to-text encoding scheme that converts binary data into a sequence of printable ASCII characters. It uses 64 characters (A-Z, a-z, 0-9, +, /) to represent data, making it safe for transmission through text-based protocols like email, JSON, and URLs.

Why does Base64 make files larger?

Base64 encoding increases data size by approximately 33%. This is because it converts every 3 bytes of binary data into 4 ASCII characters. The trade-off is that the data becomes safely transmittable through text-only channels.

What is URL-safe Base64?

URL-safe Base64 replaces the standard + and / characters with - and _ respectively, and optionally removes padding (=). This makes the encoded string safe to use in URLs, query parameters, and filenames without additional encoding.

What is a Data URI?

A Data URI (data:mime/type;base64,...) embeds file data directly in HTML, CSS, or JavaScript as a Base64 string. This eliminates an extra HTTP request for small files like icons or logos, improving page load performance.

Is my data safe when using this tool?

Yes, completely safe. All encoding and decoding happens in your browser using JavaScript. Your data is never sent to any server. You can verify this by checking the Network tab in your browser developer tools.