Base64 Encoding
Binary-to-text encoding that maps every 3 input bytes (24 bits) to 4 printable ASCII characters drawn from a 64-character alphabet, used by {{MIME}} to carry binary data through 7-bit-clean mail transports and widely reused for embedding small blobs in JSON, URLs, and HTTP headers.
Base64 is a family of binary-to-text encodings that represent arbitrary bytes using a 64-character subset of printable ASCII. The mathematics is simple: the least common multiple of 6 and 8 is 24, so three 8-bit bytes pack neatly into four 6-bit groups, and each 6-bit group indexes one character of the alphabet. Three input bytes always produce four output characters; when the input length is not a multiple of three, one or two "=" pad characters appear at the end. The variant defined by MIME in RFC 2045 uses A-Z, a-z, and 0-9 for indices 0-61, then "+" and "/" for 62 and 63. Lines are wrapped at 76 characters to satisfy SMTP line-length limits. The encoding expands data by exactly 33% (plus line breaks), which is the cost of passing eight-bit bytes through a seven-bit, line-oriented transport. Base64 predates MIME — it descended from the printable encoding used in Privacy Enhanced Mail (PEM, 1987) — but MIME made it ubiquitous. Later variants adjusted the alphabet for other contexts: base64url (RFC 4648) replaces "+" and "/" with "-" and "_" so the output is safe in URLs and filenames, and is the form used by JWT tokens. Base64 is not encryption and offers no confidentiality; it is purely a transport-safety wrapper.