MT
MUSETOOLSDeveloper Utilities

Base64 Encoder / Decoder

Convert text or files to and from Base64 encoding with various options

Result

About Base64 Encoding

Base64 is a binary-to-text encoding scheme that represents binary data in an ASCII string format by translating it into a radix-64 representation. The term Base64 originates from a specific MIME content transfer encoding.

Base64 Variants

  • Standard Base64 - Uses A-Z, a-z, 0-9, +, and / with = padding. This is the most common variant used in email and other general applications.
  • URL-safe Base64 - Uses A-Z, a-z, 0-9, -, and _ instead of + and / to avoid URL encoding issues when used in URLs.
  • Filename-safe Base64 - Similar to URL-safe but also omits the padding character (=) to make it safe for use in filenames.
  • MIME Base64 - Standard Base64 with line breaks every 76 characters, as specified by RFC 2045 for email attachments.

Common Uses of Base64

  • Embedding binary data (like images) in text-based formats such as HTML, CSS, or JSON
  • Encoding email attachments (MIME)
  • Storing complex data in cookies or local storage
  • Transmitting binary data over text-only protocols
  • Embedding small images directly in HTML/CSS using data URIs
  • Encoding authentication credentials in Basic Authentication

Base64 Encoding Process

Base64 encoding works by converting every 3 bytes (24 bits) of binary data into 4 Base64 characters (each representing 6 bits). If the input data length is not divisible by 3, padding characters (=) are added to ensure the output length is a multiple of 4 characters.

Original ASCIIASCII BinaryBase64 6-bit GroupsBase64 Encoded
Man01001101 01100001 01101110010011 010110 000101 101110TWFu
A01000001010000 010000QQ==