Base64 Encoder/Decoder

Encode and decode Base64 for text, files, and images — instant and private

🔒 Files never leave your browser

Tool component not found.

How to Use Base64 Encoder/Decoder

Choose your mode

Select Text, File, or Image Preview mode. Pick encode or decode direction.

Provide input

Type text, upload a file, or paste Base64 data. Conversion happens instantly.

Copy or download

Copy the result to clipboard or download as a file.

Why Choose AllTools Base64 Encoder/Decoder?

  • 100% free, no account needed
  • Data never leaves your browser
  • Text ↔ Base64 with live conversion
  • File ↔ Base64 for any file type
  • Image Base64 preview with dimensions
  • URL-safe Base64 mode
  • Data URI prefix toggle
  • Line break formatting (76 chars)
  • UTF-8 encoding support
  • Swap, paste, copy, and download actions

How Base64 Encoding Works

Base64 encoding converts binary data into a text representation using 64 printable ASCII characters: A-Z, a-z, 0-9, plus (+), and forward slash (/), with equals (=) used for padding. The name comes from the 64-character alphabet used. Every 3 bytes of binary data become 4 Base64 characters, which means Base64-encoded data is approximately 33% larger than the original. This size increase is an acceptable tradeoff when you need to transmit binary data through systems designed for text — email systems, URLs, JSON fields, XML documents, and HTML attributes. The encoding process takes each group of 3 bytes (24 bits) and splits it into four 6-bit groups. Each 6-bit value maps to a character in the Base64 alphabet. If the input isn't divisible by 3, padding characters (=) are added to make the output length a multiple of 4. The AllTools Base64 Encoder performs all encoding and decoding in the browser using JavaScript's built-in btoa() and atob() functions for text, and FileReader API for binary files. Nothing is transmitted — your data is encoded and decoded entirely in your browser's memory.

Practical Uses for Base64 in Development

Base64 encoding appears throughout modern web development in specific contexts where binary data must be represented as text. Data URIs embed images directly in HTML and CSS without separate HTTP requests — a small icon encoded as Base64 in a CSS background-image eliminates one network round trip. Email attachments are Base64-encoded since SMTP was designed for 7-bit ASCII text — email clients transparently encode and decode attachments during sending and receiving. JSON APIs that need to transfer binary files (images, documents, audio) often Base64-encode them to avoid multipart form complexity. JWT tokens encode their JSON payload in Base64url format (a URL-safe variant that replaces + with - and / with _). Basic HTTP authentication encodes username:password as Base64 in the Authorization header. Canvas element's toDataURL() method returns Base64-encoded image data for in-browser image processing. SVG data URIs in CSS backgrounds embed vector graphics as Base64. When debugging API responses, developers frequently need to decode Base64 values to inspect the underlying data — the AllTools decoder provides instant results without copying data to external services.

Related Resources

Frequently Asked Questions

What is Base64 encoding?
Base64 is a binary-to-text encoding scheme that converts binary data into ASCII characters. It is commonly used to embed images in HTML/CSS and transmit binary data in text-based protocols.
Is this Base64 tool free?
Yes, completely free. No account, no subscription, no hidden fees.
Does my data get uploaded?
No. All encoding and decoding happens directly in your browser using JavaScript. Your data never leaves your device.
What is URL-safe Base64?
URL-safe Base64 replaces + with -, / with _, and removes trailing = padding. This makes the output safe to use in URLs without additional encoding.
Can I encode files to Base64?
Yes. Switch to File mode and upload any file. The tool converts it to a Base64 string that you can copy or download.
Can I preview Base64 images?
Yes. Switch to Image Preview mode and paste a Base64-encoded image string to see it rendered with dimensions and download option.
What is a data URI?
A data URI (data:mime;base64,...) is a way to embed file data directly in HTML, CSS, or JavaScript instead of linking to an external file.
Does it support UTF-8?
Yes. The tool properly handles UTF-8 text including emoji and non-ASCII characters.
Does this work on mobile?
Yes, all AllTools tools are mobile-optimized and work on iOS and Android browsers.

Related Articles

Related Tools

Dev

URL Encoder/Decoder

Encode and decode URLs and URI components instantly

Dev

JSON Formatter & Validator

Format, validate, diff, and convert JSON with tree view and YAML export

Dev

Hash Generator MD5/SHA

Generate and compare MD5, SHA-1, SHA-256, SHA-512 hashes instantly

Dev

JWT Decoder

Decode JWT tokens to inspect header, payload, and expiration status

Security

QR Code Generator

Generate and customize QR codes with logos and presets

Security

Password Generator

Generate passwords, passphrases, and PINs — custom