Base64 Encoder/Decoder

Automatically encodes plain text to Base64 or decodes Base64 back to text.

Converted output will appear here

About Base64 Encoder/Decoder

What is Base64?

Base64 is a binary-to-text encoding scheme that represents binary data using a set of 64 printable ASCII characters. It was designed to allow binary data to be safely transmitted through channels that were designed to handle text only, such as email systems and HTTP.

How Base64 Works

Base64 encoding works by dividing the input data into 3-byte (24-bit) chunks, then representing each chunk as 4 characters from the Base64 alphabet. This alphabet consists of:

  • A-Z (uppercase letters) - 26 characters
  • a-z (lowercase letters) - 26 characters
  • 0-9 (numbers) - 10 characters
  • +/ (plus and slash) - 2 characters (or - and _ in URL-safe variant)

When the input data length is not divisible by 3, padding with '=' characters is added to ensure the output length is a multiple of 4. This is why Base64 strings often end with one or two '=' characters.

Technical Details

Encoding Ratio:

33% size increase (3 bytes → 4 characters)

Character Set:

64 characters (A-Z, a-z, 0-9, +/)

Padding Character:

'=' (equals sign)

Variants:

Standard, URL-safe, Filename-safe

Primary Applications

  • Email Attachments (MIME): Base64 encoding is used to embed binary files like images and documents in email messages.
  • Data URIs: Allows embedding of images and other resources directly in HTML, CSS, or JavaScript using the data: URL scheme.
  • API Data Transfer: Safely transmits binary data in JSON payloads without character encoding issues.
  • XML Content: Embeds binary data in XML documents which can only contain text.
  • Authentication Systems: Used in HTTP basic authentication and parts of OAuth implementations.
  • Cryptography: Often used to represent binary data in cryptographic applications such as SSL certificates and encryption keys.