What is Base64?

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. It uses 64 printable characters (A-Z, a-z, 0-9, +, /) to encode binary data.

Quick Facts

Full NameBase64 Encoding
Created1987 (Privacy Enhanced Mail specification)
SpecificationOfficial Specification

How Base64 Works

Base64 encoding works by taking three bytes (24 bits) of binary data and converting them into four ASCII characters. Each character represents 6 bits of the original data. If the input length is not divisible by 3, padding characters (=) are added to make the output length a multiple of 4. This encoding increases the data size by approximately 33% but ensures the data can be safely transmitted through systems that only support ASCII text.

Key Characteristics

  • Uses 64 printable ASCII characters for encoding
  • Output is approximately 33% larger than input
  • Padding with '=' characters when input length is not divisible by 3
  • URL-safe variant uses '-' and '_' instead of '+' and '/'
  • Reversible encoding - can be decoded back to original binary
  • Not encryption - provides no security, only encoding

Common Use Cases

  1. Embedding images in HTML/CSS using data URIs
  2. Encoding email attachments (MIME)
  3. Storing binary data in JSON or XML
  4. Encoding authentication credentials in HTTP Basic Auth
  5. Transmitting binary data through text-only protocols

Example

Original: Hello World
Base64:   SGVsbG8gV29ybGQ=

Original: {"key": "value"}
Base64:   eyJrZXkiOiAidmFsdWUifQ==

Related Tools on QubitTool

Related Concepts