Base64 Encoder/Decoder

Encode text, images and files to Base64 or decode Base64 strings.

Input size: {{ inputSize }} | Output size: {{ outputSize }} Base64 detected → Decoding
{{ errorMsg }}

Drag & drop a file here or click to select

{{ fileInfo.name }} ({{ formatBytes(fileInfo.size) }}) — {{ fileInfo.type || 'unknown' }}
Output size: {{ formatBytes(fileDataUri.length) }}

What Is Base64 Encoding?

Base64 is an encoding scheme that converts binary data into an ASCII string. It maps every 3 bytes to 4 printable characters (A–Z, a–z, 0–9, +, /). The result is about 33% larger than the original data, but it can be safely embedded in text-based protocols like email, JSON, or HTML.

How Does Base64 Work?

The algorithm takes the input byte stream and splits it into blocks of 3 bytes (24 bits). Each block is divided into four 6-bit groups that serve as indices into a 64-character alphabet. If the length is not divisible by 3, padding characters (=) are appended. The result is pure ASCII text.

Common Use Cases

  • Embedding images as Data URIs in CSS or HTML to reduce HTTP requests.
  • Transporting binary data in JSON APIs or XML documents.
  • Encoding email attachments via MIME.
  • Safely transmitting tokens and credentials in URLs or headers (e.g., HTTP Basic Auth).