Base64 Encode / Decode Tool

Free online converter for text, images, and files to Base64.

What is Base64? A Comprehensive Guide

Base64 is a fundamental **binary-to-text encoding** scheme defined by RFC 4648. Its core purpose is to solve a common problem: how to safely transmit or store binary data (like an image, audio file, or zip archive) in systems that are designed to only handle plain text.

The Problem: Text-based formats like JSON, XML, or email (MIME) can misinterpret or corrupt raw binary data, which often contains null characters or other control codes.

The Solution: Base64 encoding translates this binary data into a "safe" 64-character ASCII string. It works by processing the input in 3-byte (24-bit) chunks and representing them as 4 output characters, using an alphabet of A-Z, a-z, 0-9, +, and /. If the input isn't a multiple of 3, it adds = characters as padding.

Key Use Cases for this Converter:

  • Data URIs (Image to Base64): You can embed images directly into HTML or CSS without needing a separate file. This is great for small icons or logos.
    Example: <img src="data:image/png;base64,iVBORw0...">
  • Email Attachments (MIME): The original use case for Base64, allowing files to be attached to plain text emails.
  • Storing Binary in JSON/XML: Safely include binary data (e.g., a small PDF or key file) within a JSON or XML document.
  • JWTs (Base64URL): JSON Web Tokens use a URL-safe variant of Base64 (called Base64URL) to encode their Header and Payload sections.
Our Base64 converter tool allows you to easily encode any text to Base64 (Text to Base64) or decode a Base64 string back into readable text (Base64 to Text).

Base64 Encode/Decode Examples

Loading Base64 examples...

Base64 Best Practices & Key Concepts

🚫

Myth: Base64 is Encryption

This is the #1 misconception. Base64 is **not encryption**, it is an *encoding*. It provides no security or confidentiality. Any Base64 string can be instantly decoded by anyone. Never use it to "hide" passwords or secrets. For that, you must use encryption like AES.

🔑

Base64 vs. Base64URL

The standard Base64 alphabet (RFC 4648) uses + and /. These characters are not safe for file names or URLs. A variant, **Base64URL**, replaces + with - and / with _ (and often removes padding). This is the format used in JWTs (JSON Web Tokens) and other web-safe applications.

📦

What is Padding (The '=' Sign)?

Base64 processes data in 3-byte blocks. If your input data length isn't a perfect multiple of 3, the output string is "padded" with one or two = characters at the end to make its length a multiple of 4. This tells the decoder that the original data was not a multiple of 3.

Frequently Asked Questions (Base64)

From Our Blog