Dev Tools

Base64 Encoder & Decoder

Encode text or files to Base64, or decode Base64 back to text. Supports URL-safe mode and auto-detection.

Quick Answer

Base64 encoding converts binary data into a 64-character ASCII alphabet (A-Z, a-z, 0-9, +, /), making it safe for text-based protocols like email and URLs. Encoding increases data size by approximately 33% (3 bytes become 4 characters). URL-safe Base64 replaces + with - and / with _ to avoid conflicts with URL parameters.

File to Base64

Drag & drop a file here, or click to browse

About This Tool

The Base64 Encoder & Decoder is a free online tool that converts text and files to and from Base64 encoding in real time. Base64 is a binary-to-text encoding scheme that represents binary data using 64 printable ASCII characters, making it safe to transmit through text-based protocols like email, JSON, and URLs.

In Encode mode, type or paste any text and the tool instantly produces the Base64 representation. In Decode mode, paste a Base64 string and get the original text back. Toggle URL-safe mode to use the RFC 4648 variant that replaces + with - and / with _, which is commonly used in JWTs, URL parameters, and file names.

The file upload feature lets you drag and drop any file to encode it as Base64. This is useful for embedding small images as data URIs in HTML or CSS, encoding binary attachments for JSON APIs, or converting files for text-based storage. The tool shows both the original file size and the encoded size so you can evaluate the overhead.

Auto-detection analyzes your input: if you paste something that looks like Base64 while in Encode mode, the tool offers to switch to Decode mode automatically. All processing happens in your browser — no data is sent to any server.

Frequently Asked Questions

What is Base64 encoding?
Base64 is a binary-to-text encoding scheme that represents binary data as an ASCII string. It uses 64 characters (A-Z, a-z, 0-9, +, /) plus = for padding. Every 3 bytes of binary data become 4 Base64 characters, making the output roughly 33% larger than the input. It is used when binary data needs to travel through text-only channels like email (MIME), JSON, XML, or URLs.
When should I use Base64 encoding?
Common use cases include: embedding small images directly in HTML or CSS (data URIs), sending binary files in JSON API payloads, encoding authentication credentials (HTTP Basic Auth), encoding email attachments (MIME), and storing binary data in text-only databases or config files. Avoid Base64 for large files since it adds 33% overhead.
What is URL-safe Base64?
Standard Base64 uses + and / characters, which have special meaning in URLs. URL-safe Base64 (also called base64url, defined in RFC 4648) replaces + with - and / with _, and often omits the trailing = padding. This variant is used in JWTs (JSON Web Tokens), URL parameters, and filename-safe encoding.
Why are images often Base64 encoded?
Small images (icons, logos under ~10KB) are sometimes Base64-encoded and embedded directly in HTML or CSS as data URIs. This eliminates an extra HTTP request, which can improve page load performance for small assets. However, Base64 adds 33% size overhead, so larger images should be served as separate files. Modern HTTP/2 makes this optimization less critical.
Is my data stored or sent to a server?
No. All encoding and decoding happens entirely in your browser using JavaScript's built-in btoa() and atob() functions. Your data never leaves your device -- nothing is sent to any server, stored, or logged. The tool works completely offline once the page loads.