?? Base64 Encoder/Decoder

Encode and decode Base64 strings

📖 Base64 Encoding Guide

What is Base64 Encoding?

Base64 encoding is a method to represent binary data (like images, files, or random bytes) as plain text using only 64 printable ASCII characters. Those 64 characters are: A-Z (26 uppercase letters), a-z (26 lowercase letters), 0-9 (10 digits), + and / (2 symbols), plus = for padding.

The name "Base64" comes from using 64 different characters to represent data. In computer terms, that's 2^6, meaning each Base64 character represents exactly 6 bits of data. Use our free base64 encoder and base64 decoder tool above to instantly encode base64 or decode base64 online.

Why Developers Use Base64 (It's NOT Encryption!)

Here's the important thing: Base64 is NOT encryption. It's not secure—anyone can decode Base64 instantly. So why do developers use this base64 converter method?

  • Binary Data in Text-Only Systems: Many systems (email, JSON, XML, URLs) were designed to handle only text. Base64 converts binary data into text these systems can handle safely.
  • Safe Transmission: Email, HTTP headers, and URLs have restrictions on allowed characters. Base64 ensures your data survives transmission without corruption.
  • Simplicity: Instead of dealing with file uploads or binary protocols, you can paste Base64-encoded data into a JSON field or URL parameter.

Common Use Cases for Base64

  • 🖼️ Embedding Images in HTML/CSS: Encode images as data URIs (data:image/png;base64,...) to reduce HTTP requests for small icons.
  • 🔑 JWT Tokens: JSON Web Tokens are three Base64-encoded parts separated by dots. Use our base64 decoder to inspect JWT payloads.
  • 🔐 API Authentication: HTTP Basic Authentication sends credentials as Base64 in the Authorization header.
  • 📧 Email Attachments: Email was designed for text only. MIME format uses Base64 to encode file attachments.
  • 💾 Storing Binary Data: Store binary data in text database fields or JSON APIs by encoding it first.

How Base64 Encoding Works

The basic process to encode base64:

  1. Take your data (text, image, file)
  2. Convert it to binary
  3. Group the bits into chunks of 6 (since 2^6 = 64)
  4. Map each 6-bit chunk to one of the 64 Base64 characters
  5. Add padding (=) if needed to make the length a multiple of 4
Example: Encoding "Hi"
Text: H → ASCII: 72 → Binary: 01001000
Text: i → ASCII: 105 → Binary: 01101001
Grouped (6 bits): 010010 | 000110 | 1001 (needs padding)
Result: SGk=

The 33% Overhead Problem

Base64 increases data size by approximately 33%. Why? We're representing 8-bit bytes using only 6 bits per character. To represent 3 bytes (24 bits), you need 4 Base64 characters. This is why you shouldn't use Base64 for large files—the overhead kills performance. Use our base64 converter for small data, proper file uploads for large files.

FAQ

Is Base64 secure?

No. Base64 is encoding, not encryption. It's like writing in a different alphabet—anyone can translate it back. Never use Base64 alone to protect sensitive data. Use proper encryption (AES, RSA) for security.

Why does Base64 end with "=" symbols?

The = symbols are padding. Base64 output must be a multiple of 4 characters. If it's not, = characters are added. When you decode base64 online, the decoder uses these to know where the data ends.

Can I encode images to Base64?

Yes! Small icons (<5KB) are fine for embedding in HTML/CSS to reduce HTTP requests. For images over 10-20KB, use separate image files—the 33% overhead makes embedded images inefficient.

What's the difference between Base64 and Base64URL?

Base64URL is a URL-safe variant that uses - and _ instead of + and /, and typically omits padding. It's used in JWTs and wherever Base64 data appears in URLs.

? Related Tools